History

avcodec/mpegvideo_dec: Add NULL pointer checks to MPV_motion_lowres()

This makes the null pointer checks match mpv_motion_internal() Fixes: NULL pointer dereference Fixes: 59671/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-4993004566609920 Fixes: 59678/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-4893168991338496

Michael Niedermayer committed 3 years ago

Commit adfe0031 parent d7d3f1a1 file · +8 −5Browse files

Unified · Split

libavcodec/mpegvideo_dec.c+8−5
@@ -885,10 +885,9 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 884 unmodified lines
885885 s->mv[dir][1][0], s->mv[dir][1][1],
886886 block_s, mb_y);
887887 } else {
888− if (s->picture_structure != s->field_select[dir][0] + 1 &&
889− s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
888+ if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
889+ || !ref_picture[0]) {
890890 ref_picture = s->current_picture_ptr->f->data;
891−
892891 }
893892 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
894893 0, 0, s->field_select[dir][0],
@@ -901,8 +900,9 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 6 unmodified lines
901900 for (int i = 0; i < 2; i++) {
902901 uint8_t *const *ref2picture;
903902
904− if (s->picture_structure == s->field_select[dir][i] + 1 ||
905− s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
903+ if ((s->picture_structure == s->field_select[dir][i] + 1 ||
904+ s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&
905+ ref_picture[0]) {
906906 ref2picture = ref_picture;
907907 } else {
908908 ref2picture = s->current_picture_ptr->f->data;
@@ -933,6 +933,9 @@ static inline void MPV_motion_lowres(MpegEncContext *s, · 24 unmodified lines
933933 pix_op = s->h264chroma.avg_h264_chroma_pixels_tab;
934934 }
935935 } else {
936+ if (!ref_picture[0]) {
937+ ref_picture = s->current_picture_ptr->f->data;
938+ }
936939 for (int i = 0; i < 2; i++) {
937940 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
938941 0, 0, s->picture_structure != i + 1,

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