Fix core dump on huge switch
Christopher Li
maintainerPATCH 1/1 Fix core dump on huge switch
Bump up the size of the instruction buffer. vt_ioctl.c has a huge switch statement causing sparse over flow the instruction buffer.
Signed-off-by Christopher Li <[email protected]>
linearize.c +4 -1
@@ -272,7 +272,7 @@ static char *show_asm(char *buf, structconst char *show_instruction (struct instruction *insn) {int opcode = insn->opcode; -static char buffer[1024 ]; +static char buffer[4096 ];char *buf; buf = buffer;
@@ -457,6 +457,9 @@ const char *show_instruction(struct instdefault :break ; } + +if (buf >= buffer +sizeof buffer) +die ("instruction buffer overflowed %d\n" , buf - buffer);do { --buf; }while (*buf ==' ' ); *++buf =0 ;return buffer;
Josh Triplett
AppliedQuoted 5 lines · Christopher Li
Bump up the size of the instruction buffer.
vt_ioctl.chas a huge switch statement causing sparse over flow the instruction buffer.Signed-off-by Christopher Li <[email protected]>
I've applied this fix for now, to solve the immediate problem; thanks for the patch.
Ideally I'd like to see some solution that grows the buffer as needed.
I also committed one minor style fix after your patch:
linearize.c const char *show_instruction(struct inst · line 461
Quoted 1 line
linearize.c +1
-0+if (buf >= buffer +sizeof buffer)
Please use parentheses with sizeof, per the Linux Documentation/CodingStyle.
- Josh Triplett