[XviD-devel] Decoding stream

Stephan Assmus superstippi at gmx.de
Mon Jun 23 12:05:30 CEST 2008


Michael Militzer wrote:
> it is correct that the xvid decoder expects to be fed with full frames 
> all the time. If you provide less data the decoder may read outside your 
> buffer and crash or detect the problem, incorrectly decode the frame and 
> return (the intended behavior).
> 
> So to fix your problem you need to ensure that your buffer contains at 
> least one full frame of data when you call the decoder.

I think this situation should be fixed.

1) If an API call gets the buffer size, it may as well respect it no matter 
what.

2) This is speculation, but it sounds like the decoder depends on the data 
in the chunk being 100% valid, or it may read outside the provided 
boundaries, even if those indeed contain a full frame. In real life, the 
data may be corrupt, and even then I would like it to not crash.

Hopefully, this doesn't come across as harsh, I just mean to express an 
opinion from an API user point of view. It's just something that I believe 
belongs in the library and not in the API user code, otherwise this just 
means duplicated code with varying degrees of quality, and with 2) I am 
demonstrating that the API user has no chance of handling corrupt data 
correctly anyways. The most convenient way would be for xvid to cash 
incomplete frame data. As an alternative, it should be made clear in the 
API that only complete frame data may be passed for it to produce output, 
but even then xvid should respect the provided buffer size no matter what 
and return an error if it is too small.

Best regards,
-Stephan


More information about the XviD-devel mailing list