Hi,

On Mon, Jan 9, 2012 at 4:33 PM, Ronald S. Bultje <[email protected]> wrote:
> Hi,
>
> mostly LGTM, 1 thing:
>
> On Mon, Jan 9, 2012 at 1:46 PM, Laurentiu Ion
> <[email protected]> wrote:
>> -static int kmvc_decode_inter_8x8(KmvcContext * ctx, const uint8_t * src, 
>> int src_size, int w, int h)
>> +static int kmvc_decode_inter_8x8(KmvcContext * ctx, GetByteContext *g, int 
>> w, int h)
> [..]
>>     for (by = 0; by < h; by += 8)
>>         for (bx = 0; bx < w; bx += 8) {
>> -            kmvc_getbit(bb, src, src_end, res);
>> +            kmvc_getbit(bb, g, res);
>>             if (!res) {
>> -                kmvc_getbit(bb, src, src_end, res);
>> +                kmvc_getbit(bb, g, res);
>>                 if (!res) {     // fill whole 8x8 block
>> -                    if (src >= src_end) {
>> +                    if (!bytestream2_get_bytes_left(g)) {
>>                         av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n");
>>                         return AVERROR_INVALIDDATA;
>>                     }
> [..]
>
>>             } else {            // handle four 4x4 subblocks
>>                 for (i = 0; i < 4; i++) {
>> +                    if (!bytestream2_get_bytes_left(g)) {
>> +                        av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n");
>> +                        return AVERROR_INVALIDDATA;
>> +                    }
>
> Can you factor this check out of the if/else block so that it's not 
> duplicated?

Nevermind, there's cases where no bytes is legal. Please move
GetByteContext into KmvcContext and then LGTM.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to