Skip to content

Commit 70a3403

Browse files
committed
pullpush: return 0 if pulling a varint from an exhausted buffer
1 parent 1fffafa commit 70a3403

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pullpush.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ uint64_t pull_varint(const unsigned char **cursor, size_t *max)
149149
uint64_t v;
150150

151151
pull_bytes(buf, 1, cursor, max);
152+
if (!*cursor)
153+
return 0;
152154
if ((len = varint_length_from_bytes(buf) - 1))
153155
pull_bytes(buf + 1, len, cursor, max);
156+
if (!*cursor)
157+
return 0;
154158
varint_from_bytes(buf, &v);
155159
return v;
156160
}

0 commit comments

Comments
 (0)