[FFmpeg-devel] [PATCH] avcodec: add PhotoCD decoder
Paul B Mahol
onemda at gmail.com
Sun Aug 30 10:04:40 EEST 2020
On 8/30/20, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
[...]
>> +static int read_hufftable(AVCodecContext *avctx, VLC *vlc)
>> +{
>> + PhotoCDContext *s = avctx->priv_data;
>> + GetByteContext *gb = &s->gb;
>> + int start = s->streampos;
>> + int count, ret;
>> +
>> + bytestream2_seek(gb, start, SEEK_SET);
>> +
>> + count = bytestream2_get_byte(gb) + 1;
>> +
>
> With this information you can check once whether there is enough data
> left, allowing you to use the unchecked versions of the bytestream2 API.
Fixed locally.
>
>> + ff_free_vlc(vlc);
>> +
>> + for (int j = 0; j < count; j++) {
>> + const int bit = bytestream2_get_byte(gb) + 1;
>> + const int code = bytestream2_get_be16(gb) >> (16 - bit);
>
> You are using bit here before having validated it.
Fixed locally.
[...]
More information about the ffmpeg-devel
mailing list