diff options
author | Josh Haberman <jhaberman@gmail.com> | 2013-10-24 13:09:41 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2013-10-24 13:09:41 -0700 |
commit | ccb2f8ab8727315b6b520cbdf1ea3a5501f4e1db (patch) | |
tree | da23636a575abeeece4079ac69c8ffda1225e902 /upb/pb/decoder.c | |
parent | 26d98ca94f2f049e8767b4a9a33d185a3d7ea0fd (diff) |
Fixes to make the open-source build compile on Linux.
Diffstat (limited to 'upb/pb/decoder.c')
-rw-r--r-- | upb/pb/decoder.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |