Fixes: signed integer overflow: 1107820800 + 1107820800 cannot be represented in type 'int' Fixes: left shift of 1091059712 by 6 places cannot be represented in type 'int' Fixes: 69910/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5162839971528704
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -476,13 +476,14 @@ static int slices_realloc(VVCFrameContext *fc) · 475 unmodified lines | ||
| 476 | 476 | return 0; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | −static void ep_init_cabac_decoder(SliceContext *sc, const int index, | |
| 479 | +static int ep_init_cabac_decoder(SliceContext *sc, const int index, | |
| 480 | 480 | const H2645NAL *nal, GetBitContext *gb, const CodedBitstreamUnit *unit) |
| 481 | 481 | { |
| 482 | 482 | const H266RawSlice *slice = unit->content_ref; |
| 483 | 483 | const H266RawSliceHeader *rsh = sc->sh.r; |
| 484 | 484 | EntryPoint *ep = sc->eps + index; |
| 485 | 485 | int size; |
| 486 | + int ret; | |
| 486 | 487 | |
| 487 | 488 | if (index < rsh->num_entry_points) { |
| 488 | 489 | int skipped = 0; |
| @@ -501,8 +502,11 @@ static void ep_init_cabac_decoder(SliceContext *sc, const int index, · 12 unmodified lines | ||
| 501 | 502 | size = get_bits_left(gb) / 8; |
| 502 | 503 | } |
| 503 | 504 | av_assert0(gb->buffer + get_bits_count(gb) / 8 + size <= gb->buffer_end); |
| 504 | − ff_init_cabac_decoder (&ep->cc, gb->buffer + get_bits_count(gb) / 8, size); | |
| 505 | + ret = ff_init_cabac_decoder (&ep->cc, gb->buffer + get_bits_count(gb) / 8, size); | |
| 506 | + if (ret < 0) | |
| 507 | + return ret; | |
| 505 | 508 | skip_bits(gb, size * 8); |
| 509 | + return 0; | |
| 506 | 510 | } |
| 507 | 511 | |
| 508 | 512 | static int slice_init_entry_points(SliceContext *sc, |
| @@ -538,7 +542,9 @@ static int slice_init_entry_points(SliceContext *sc, · 29 unmodified lines | ||
| 538 | 542 | fc->tab.slice_idx[rs] = sc->slice_idx; |
| 539 | 543 | } |
| 540 | 544 | |
| 541 | − ep_init_cabac_decoder(sc, i, nal, &gb, unit); | |
| 545 | + ret = ep_init_cabac_decoder(sc, i, nal, &gb, unit); | |
| 546 | + if (ret < 0) | |
| 547 | + return ret; | |
| 542 | 548 | |
| 543 | 549 | if (i + 1 < sc->nb_eps) |
| 544 | 550 | ctu_addr = sh->entry_point_start_ctu[i]; |