Skip to content

Commit

Permalink
Apply Debian CVE-2022-24795.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Oct 26, 2023
1 parent ce9520f commit e425ef9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/yajl/yajl_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ void yajl_buf_ensure_available(yajl_buf buf, size_t want)

need = buf->len;

while (want >= (need - buf->used)) need <<= 1;
if (((buf->used > want) ? buf->used : want) > (size_t)(buf->used + want)) {
/* We cannot allocate more memory than SIZE_MAX. */
abort();
}
while (want >= (need - buf->used)) {
if (need >= (size_t)((size_t)(-1)<<1)>>1) {
/* need would overflow. */
abort();
}
need <<= 1;
}

if (need != buf->len) {
buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need);
Expand Down

0 comments on commit e425ef9

Please sign in to comment.