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

Ronald S. Bultje rsbultje
Tue Mar 17 13:00:17 CET 2009


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). 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).


More information about the ffmpeg-devel mailing list