Skip to content

Commit

Permalink
fix UB of setjmp usage
Browse files Browse the repository at this point in the history
  • Loading branch information
starwing committed Jun 7, 2018
1 parent 7f92d67 commit 358b9f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pb.h
Expand Up @@ -1616,17 +1616,16 @@ static void pbL_loadFile(pb_State *S, pbL_FileInfo *info, pb_Loader *L) {
}

PB_API int pb_load(pb_State *S, pb_Slice *s) {
volatile int ret = PB_ERROR;
pbL_FileInfo *files = NULL;
pb_Loader L;
int ret;
if ((ret = setjmp(L.jbuf)) < 0)
return PB_ERROR;
else if (ret == 0) {
if (!setjmp(L.jbuf)) {
L.s = *s;
L.is_proto3 = 0;
pb_initbuffer(&L.b);
pbL_FileDescriptorSet(&L, &files);
pbL_loadFile(S, files, &L);
ret = PB_OK;
}
pbL_delFileInfo(files);
pb_resetbuffer(&L.b);
Expand Down

0 comments on commit 358b9f1

Please sign in to comment.