Comments (4)
The following patch fixes the silly behavior of storing width values into char pointers, and fixes the segfault here.
diff --git a/src/deutex.c b/src/deutex.c
index c6d85a0f437b..5a356507213b 100644
--- a/src/deutex.c
+++ b/src/deutex.c
@@ -710,6 +710,8 @@ typedef struct {
comfun_t exec;
char *use;
char *help;
+ uint16_t width1;
+ uint16_t width2;
} comdef_t;
/* FIXME should be at the top of the file but we need comdef_t */
@@ -1124,14 +1126,11 @@ void COMhelp(int argc, const char *argv[])
/* Do a first pass on all the options for this section. Find out how
wide the left and right columns need to be. */
if (d->type == SEC) {
- uint16_t tmp;
if (section++)
putchar('\n');
printf("%s:\n", d->help);
- memcpy(&tmp, d->exec, sizeof(tmp));
- width1 = tmp + OPTINDENT;
- memcpy(&tmp, d->use, sizeof(tmp));
- width2 = tmp;
+ width1 = d->width1 + OPTINDENT;
+ width2 = d->width2;
if (width1 + 1 + width2 > TTYCOL)
width1 = TTYCOL - width2 - COLSPACING;
}
@@ -1241,17 +1240,17 @@ static void opt_widths(void)
if (tmp != width2r)
/* Can't happen */
tmp = SHRT_MAX;
- memcpy(current_section->com, &tmp, sizeof(tmp));
+ /* current_section->width2r = tmp; */
tmp = width1t;
if (tmp != width1t)
tmp = SHRT_MAX;
- memcpy(current_section->exec, &tmp, sizeof(tmp));
+ current_section->width1 = tmp;
tmp = width2t;
if (tmp != width2t)
tmp = SHRT_MAX;
- memcpy(current_section->use, &tmp, sizeof(tmp));
+ current_section->width2 = tmp;
}
}
from deutex.
This also happens on Ubuntu 17.10.1 x64. Using gdb gives the point of failure as:
Program received signal SIGSEGV, Segmentation fault.
opt_widths () at deutex.c:1244
1244 memcpy(current_section->com, &tmp, sizeof(tmp));
from deutex.
also on aarch64. same point of failure. probably architecture independent
from deutex.
Thanks. Always wanted to investigate but always put it off :)
from deutex.
Related Issues (20)
- Conditional path seperators? HOT 2
- Finish the sscript_load function
- Recognise SCRIPTS lump as a map lump
- Use define for new PNG commands
- Don't execute WADRseek twice for music identification HOT 2
- Shorten png_offset command name HOT 1
- Add a compare feature to find different lumps in two WADs HOT 3
- Use proper -usedidx messages?
- Sprite offsets should always be horizontally centered HOT 3
- Arch Build Error missing Public Key
- segfault extracting zaub.wad HOT 6
- The lump repeat marker is a mis-feature and should be removed HOT 1
- Configure script should check for a2x by default, but error if explicitly requested HOT 3
- -merge is dumb
- Create project icon
- LisUkn when merging 2 pwads
- Open to CMake option?
- How do I extract a specific wad without deutex jumping onto other wads in the main data directory?
- bootstrap errors if asciidoc is not installed.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deutex.