[PATCH 3] Fix core dump on huge switch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <sparse@xxxxxxxxxxx>

Index: sparse/linearize.c
===================================================================
--- sparse.orig/linearize.c	2007-01-30 20:07:40.000000000 -0800
+++ sparse/linearize.c	2007-01-30 20:48:16.000000000 -0800
@@ -272,7 +272,7 @@ static char *show_asm(char *buf, struct 
 const 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 inst
 	default:
 		break;
 	}
+
+	if (buf >= buffer + sizeof buffer)
+		die("instruction buffer overflowed %d\n", buf - buffer);
 	do { --buf; } while (*buf == ' ');
 	*++buf = 0;
 	return buffer;
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux