[FFmpeg-devel] [PATCH] imx/d-10 remove klv bitstream filter
Baptiste Coudurier
baptiste.coudurier
Mon May 11 03:37:01 CEST 2009
Hi Michael,
On 5/10/2009 6:07 PM, Michael Niedermayer wrote:
> On Sat, May 09, 2009 at 07:33:46PM -0700, Baptiste Coudurier wrote:
>> Hi,
>>
>> $subject, and remove the check for d-10 in mpeg2 decoder which will no
>> longer be needed.
>>
>> [...]
>>
>> +
>> + if (!memcmp(buf, d10_klv_header, 15)) {
>> + int64_t frame_size;
>> + bufp += 16;
>> + if ((frame_size = klv_decode_ber_length(&bufp)) < 0) {
>> + av_log(avctx, AV_LOG_ERROR, "error decoding klv length\n");
>> + return -1;
>> + }
>> + if (bufp - buf + frame_size > buf_size) {
>> + av_log(avctx, AV_LOG_ERROR, "wrong frame size\n");
>> + return -1;
>> + }
>> + *poutbuf = av_malloc(frame_size);
>> + if (!*poutbuf)
>> + return AVERROR(ENOMEM);
>> + memcpy(*poutbuf, bufp, frame_size);
>
> frame_size is int64_t, av_malloc() takes unsigned int and memcpy takes
> size_t
> this is a risky combination i think if int64_t does not fit in int but
> in size_t
> av_malloc*() really should take size_t as well
Added a check for frame_size.
> also we should maybe extend the API so that a bitstream filter knows
> if it can saftely change the content of the input buffer and thus avoid
> a malloc©
Sure.
Also there is no clear documentation on bitstream filter API it seems.
buf is const though.
If we change it, we might as well take the opportunity to explicit the
case where no change is needed. I suggested some time ago that poutbuf
would not be set but 0 would be returned.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: imx_remove_klv2.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090510/eda93490/attachment.asc>
More information about the ffmpeg-devel
mailing list