Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upb: fix uninitialized upb_MessageValue buffer bugs #18160

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions upb/json/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,8 @@ static upb_MessageValue jsondec_int(jsondec* d, const upb_FieldDef* f) {

/* Parse UINT32 or UINT64 value. */
static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
upb_MessageValue val = {0};
upb_MessageValue val;
memset(&val, 0, sizeof(val));

switch (jsondec_peek(d)) {
case JD_NUMBER: {
Expand Down Expand Up @@ -748,7 +749,8 @@ static upb_MessageValue jsondec_uint(jsondec* d, const upb_FieldDef* f) {
/* Parse DOUBLE or FLOAT value. */
static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) {
upb_StringView str;
upb_MessageValue val = {0};
upb_MessageValue val;
memset(&val, 0, sizeof(val));

switch (jsondec_peek(d)) {
case JD_NUMBER:
Expand Down
3 changes: 2 additions & 1 deletion upb/reflection/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
const upb_MiniTable* mt = upb_MessageDef_MiniTable(m);
size_t i = *iter;
size_t n = upb_MiniTable_FieldCount(mt);
const upb_MessageValue zero = {0};
upb_MessageValue zero;
memset(&zero, 0, sizeof(zero));
UPB_UNUSED(ext_pool);

// Iterate over normal fields, returning the first one that is set.
Expand Down
Loading