commit | e397e3efacaeab1bc6cacc0dfdc259768aebfd8e | [log] [tgz] |
---|---|---|
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | Mon Jan 20 19:48:19 2020 +0200 |
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | Mon Jan 20 19:59:10 2020 +0200 |
tree | a8ffe78846647855b00db182a26c558b5ee37f31 | |
parent | 927a79c7d3778c4b91863e022ad77e78d54d6899 [diff] |
Further fix for clang sanitizer errors
diff --git a/pb_decode.c b/pb_decode.c index de93f8d..e2574d7 100644 --- a/pb_decode.c +++ b/pb_decode.c
@@ -1547,8 +1547,11 @@ if (!pb_decode_varint32(stream, &size)) return false; + if (size == (uint32_t)-1) + PB_RETURN_ERROR(stream, "size too large"); + /* Space for null terminator */ - alloc_size = (size_t)((size_t)size + 1); + alloc_size = (size_t)(size + 1); if (alloc_size < size) PB_RETURN_ERROR(stream, "size too large");