On 13/10/13 23:27, Justin Ruggles wrote:
> This is basically an overread/overwrite-safe memcpy between a
> GetByteContext and a PutByteContext.
> ---
>  libavcodec/bytestream.h |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
> index 63d61f1..21b1cba 100644
> --- a/libavcodec/bytestream.h
> +++ b/libavcodec/bytestream.h
> @@ -325,6 +325,35 @@ static av_always_inline unsigned int 
> bytestream2_get_eof(PutByteContext *p)
>      return p->eof;
>  }
>  
> +static av_always_inline unsigned int bytestream2_copy_buffer(PutByteContext 
> *p,
> +                                                             GetByteContext 
> *g,
> +                                                             unsigned int 
> size)
> +{
> +    int size2;
> +
> +    if (p->eof)
> +        return 0;
> +    size2 = FFMIN(p->buffer_end - p->buffer, size);
> +    if (size2 != size)
> +        p->eof = 1;
> +    size2 = FFMIN(g->buffer_end - g->buffer, size2);

return bytestream2_copy_bufferu(p, g, size)

> +static av_always_inline unsigned int bytestream2_copy_bufferu(PutByteContext 
> *p,
> +                                                              GetByteContext 
> *g,
> +                                                              unsigned int 
> size)

move it above.

The rest seem fine.

lu

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to