From ccb2f8ab8727315b6b520cbdf1ea3a5501f4e1db Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 24 Oct 2013 13:09:41 -0700 Subject: Fixes to make the open-source build compile on Linux. --- upb/pb/decoder.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'upb/pb/decoder.c') diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c index 0cfb12e..70862d5 100644 --- a/upb/pb/decoder.c +++ b/upb/pb/decoder.c @@ -333,6 +333,10 @@ FORCEINLINE int32_t decode_v32(upb_pbdecoder *d, uint32_t *u32) { if (ret >= 0) return ret; if (u64 > UINT32_MAX) { seterr(d, "Unterminated 32-bit varint"); + // TODO(haberman) guarantee that this function return is >= 0 somehow, + // so we know this path will always be treated as error by our caller. + // Right now the size_t -> int32_t can overflow and produce negative values. + *u32 = 0; return upb_pbdecoder_suspend(d); } *u32 = u64; -- cgit v1.2.3