arbeitspferde/sawzall — pull request #1 by matttproud (2014-03-01 22:08:49+00:00)
Title: Fix numeric stringification in generated code.

The original code possesses a problem whereby the stringification of
numeric values in generated code can overrun the allotted buffer in
the inlined stringification helper function.

Namely, the following scenario yields a segmentation fault:

// foo.proto
message Foo {
optional int32 some_field = 1 [default=1000];
}

# compiling
$ protoc --szl_out=. foo.proto

This is because (len("2147483647") / 10) + 3 = 4, the default buffer
size for int32, is insufficient for sprintf(buf, fmt, value) of 1000
plus the null terminator. I presume this was just an oversight.