comparison mjpegdec.c @ 9912:9502108caadf libavcodec

mjpegdec: check that the coded dc_index and ac_index have a valid associated VLC table. Removes some disabled dc_index/ac_index checking code that seems to have had some undocumented issues and should not really be necessary anymore now. Fixes from issue 1240 the files mjpeg/smclockmjpeg.avi.1.10 and mjpeg/smclockmjpeg.avi.1.171.
author reimar
date Sat, 04 Jul 2009 12:54:36 +0000
parents 473fbc242b43
children b73796e93571
comparison
equal deleted inserted replaced
9911:14edbbff0f25 9912:9502108caadf
920 s->ac_index[i] = get_bits(&s->gb, 4); 920 s->ac_index[i] = get_bits(&s->gb, 4);
921 921
922 if (s->dc_index[i] < 0 || s->ac_index[i] < 0 || 922 if (s->dc_index[i] < 0 || s->ac_index[i] < 0 ||
923 s->dc_index[i] >= 4 || s->ac_index[i] >= 4) 923 s->dc_index[i] >= 4 || s->ac_index[i] >= 4)
924 goto out_of_range; 924 goto out_of_range;
925 #if 0 //buggy 925 if (!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->ac_index[i]].table)
926 switch(s->start_code) 926 goto out_of_range;
927 {
928 case SOF0:
929 if (dc_index[i] > 1 || ac_index[i] > 1)
930 goto out_of_range;
931 break;
932 case SOF1:
933 case SOF2:
934 if (dc_index[i] > 3 || ac_index[i] > 3)
935 goto out_of_range;
936 break;
937 case SOF3:
938 if (dc_index[i] > 3 || ac_index[i] != 0)
939 goto out_of_range;
940 break;
941 }
942 #endif
943 } 927 }
944 928
945 predictor= get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */ 929 predictor= get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */
946 ilv= get_bits(&s->gb, 8); /* JPEG Se / JPEG-LS ILV */ 930 ilv= get_bits(&s->gb, 8); /* JPEG Se / JPEG-LS ILV */
947 prev_shift = get_bits(&s->gb, 4); /* Ah */ 931 prev_shift = get_bits(&s->gb, 4); /* Ah */