On Wed, Nov 12, 2014 at 12:59 PM, Luca Barbato <lu_z...@gentoo.org> wrote: > On 12/11/14 11:06, Vittorio Giovara wrote: >> On Tue, Nov 11, 2014 at 6:08 PM, Luca Barbato <lu_z...@gentoo.org> wrote: >>> On 11/11/14 17:40, Vittorio Giovara wrote: >>>> CC: libav-sta...@libav.org >>>> Bug-Id: CID 700465 / CID 1240206 >>>> --- >>>> libavcodec/lzwenc.c | 5 ++++- >>>> 1 file changed, 4 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c >>>> index 7c37bf2..2533f49 100644 >>>> --- a/libavcodec/lzwenc.c >>>> +++ b/libavcodec/lzwenc.c >>>> @@ -129,7 +129,7 @@ static inline int findCode(LZWEncodeState * s, uint8_t >>>> c, int hash_prefix) >>>> int h = hash(FFMAX(hash_prefix, 0), c); >>>> int hash_offset = hashOffset(h); >>>> >>>> - while (s->tab[h].hash_prefix != LZW_PREFIX_FREE) { >>>> + while (h >= 0 && s->tab[h].hash_prefix != LZW_PREFIX_FREE) { >>>> if ((s->tab[h].suffix == c) >>>> && (s->tab[h].hash_prefix == hash_prefix)) >>>> return h; >>> >>> h can be negative? >> >> Rereading the code there is an assert() in findCode() which initializes h. >> Should that be replaced with an averror? >> > > Yes please if it is not purely theoretical
I believe having to carry the averror may cumbersome in a hash function. The assert will prevent and BadUse anyway, so I'll mark this as false positive. -- Vittorio _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel