[FFmpeg-devel] [PATCH] rmdec.c: prevent zero-length packets

Kostya kostya.shishkov
Tue Mar 17 13:16:25 CET 2009


On Tue, Mar 17, 2009 at 08:00:17AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Tue, Mar 17, 2009 at 1:30 AM, Kostya <kostya.shishkov at gmail.com> wrote:
> > It's funny that old format code used if(len <= 0) return AVERROR(EIO);
> [..]
> > Conclusion: len = 0 is not harmless, it's invalid.
> 
> I don't want to terminate by return with a negative value, since len=0
> might just be a random bytesequence that was in the middle of a packet
> for whatever codec (i.e. wrong sync). 

Better add that check to sync - we want correct resyncinc after all.

> If we return -1, we're saying
> it's an actual error ("could not find syncpoint") or so. That's why
> I'm doing something difference than for the len<0 case (which clearly
> means EOF, if you look at how sync() returns <0).
> 
> Ronald




More information about the ffmpeg-devel mailing list