Skip to content

Commit ce2c5b2

Browse files
committed
Check return value of _end functions.
1 parent 79e44f8 commit ce2c5b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

msgpack/unpack_template.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
145145
if(top >= MSGPACK_EMBED_STACK_SIZE) { goto _failed; } /* FIXME */ \
146146
if(construct_cb(func)(user, count_, &stack[top].obj) < 0) { goto _failed; } \
147147
if((count_) == 0) { obj = stack[top].obj; \
148-
construct_cb(func##_end)(user, &obj); \
148+
if (construct_cb(func##_end)(user, &obj) < 0) { goto _failed; } \
149149
goto _push; } \
150150
stack[top].ct = ct_; \
151151
stack[top].size = count_; \
@@ -346,7 +346,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
346346
if(construct_cb(_array_item)(user, c->count, &c->obj, obj) < 0) { goto _failed; }
347347
if(++c->count == c->size) {
348348
obj = c->obj;
349-
construct_cb(_array_end)(user, &obj);
349+
if (construct_cb(_array_end)(user, &obj) < 0) { goto _failed; }
350350
--top;
351351
/*printf("stack pop %d\n", top);*/
352352
goto _push;
@@ -360,7 +360,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
360360
if(construct_cb(_map_item)(user, c->count, &c->obj, c->map_key, obj) < 0) { goto _failed; }
361361
if(++c->count == c->size) {
362362
obj = c->obj;
363-
construct_cb(_map_end)(user, &obj);
363+
if (construct_cb(_map_end)(user, &obj) < 0) { goto _failed; }
364364
--top;
365365
/*printf("stack pop %d\n", top);*/
366366
goto _push;

0 commit comments

Comments
 (0)