[FFmpeg-devel] [PATCH] libshine fixed point MP3 encoding support

Michael Niedermayer michaelni at gmx.at
Thu Aug 2 15:15:06 CEST 2012


On Mon, Jul 30, 2012 at 05:03:29PM +0000, Paul B Mahol wrote:
[...]
> +static int shine_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
> +                              const AVFrame *frame, int *got_packet_ptr)
> +{
> +    SHINEContext *s = avctx->priv_data;
> +    MPADecodeHeader hdr;
> +    unsigned char *data;
> +    long written;
> +    int ret, len;
> +
> +    if (frame)
> +        data = L3_encode_frame(s->shine, frame->data[0], &written);
> +    else
> +        data = L3_flush(s->shine, &written);
> +    if (written < 0)
> +        return -1;
> +    if (written > 0) {

> +        if (s->buffer_index + written > BUFFER_SIZE) {

the addition may theoretically overflow

written > BUFFER_SIZE - s->buffer_index
seems safer to me

no further comments from me

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120802/d0f1a4f7/attachment.asc>


More information about the ffmpeg-devel mailing list