History

avcodec/vvc/dec: Check ff_init_cabac_decoder() for failure

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

Michael Niedermayer committed 2 years ago

Commit 63982421 parent ca4ff241 file · +9 −3Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vvc/dec.c+9−3
@@ -476,13 +476,14 @@ static int slices_realloc(VVCFrameContext *fc) · 475 unmodified lines
476476 return 0;
477477 }
478478
479−static void ep_init_cabac_decoder(SliceContext *sc, const int index,
479+static int ep_init_cabac_decoder(SliceContext *sc, const int index,
480480 const H2645NAL *nal, GetBitContext *gb, const CodedBitstreamUnit *unit)
481481 {
482482 const H266RawSlice *slice = unit->content_ref;
483483 const H266RawSliceHeader *rsh = sc->sh.r;
484484 EntryPoint *ep = sc->eps + index;
485485 int size;
486+ int ret;
486487
487488 if (index < rsh->num_entry_points) {
488489 int skipped = 0;
@@ -501,8 +502,11 @@ static void ep_init_cabac_decoder(SliceContext *sc, const int index, · 12 unmodified lines
501502 size = get_bits_left(gb) / 8;
502503 }
503504 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;
505508 skip_bits(gb, size * 8);
509+ return 0;
506510 }
507511
508512 static int slice_init_entry_points(SliceContext *sc,
@@ -538,7 +542,9 @@ static int slice_init_entry_points(SliceContext *sc, · 29 unmodified lines
538542 fc->tab.slice_idx[rs] = sc->slice_idx;
539543 }
540544
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;
542548
543549 if (i + 1 < sc->nb_eps)
544550 ctu_addr = sh->entry_point_start_ctu[i];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t