Quoting Luca Barbato (2015-08-01 14:16:45)
> On 31/07/15 07:59, Anton Khirnov wrote:
> > Quoting Luca Barbato (2015-07-29 22:51:05)
> >> And restrict the string to ascii text.
> >>
> >> CC: [email protected]
> >>
> >> Signed-off-by: Luca Barbato <[email protected]>
> >> ---
> >>  libavcodec/h264_sei.c | 57 
> >> ++++++++++++++++++++++++++++++++++++++++++---------
> >>  1 file changed, 47 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> >> index 1f3844b..7361941 100644
> >> --- a/libavcodec/h264_sei.c
> >> +++ b/libavcodec/h264_sei.c
> >> @@ -191,24 +191,61 @@ static int decode_registered_user_data(H264Context 
> >> *h, int size)
> >>      return 0;
> >>  }
> >>  
> >> +static const uint8_t x264_version_uuid[] = {
> >> +    0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7,
> >> +    0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef
> >> +};
> >> +
> >> +static int decode_x264_version(H264Context *h, int size)
> >> +{
> >> +    int build = 0, i = 0;
> >> +    uint8_t x264_string[256];
> >> +
> >> +    if (size < 13)
> >> +        goto skip;
> >> +
> >> +    for (i = 0; i < size && i < sizeof(x264_string) - 1; i++)
> >> +        x264_string[i] = get_bits(&h->gb, 8) & 0x7f;
> > 
> > I don't think this is enough, there are still control characters in this
> > range (or the caller can have a weird character set). Either filter out
> > everything before ' ', or use isprint() perhaps?
> > 
> >> +
> >> +    x264_string[i] = 0;
> >> +
> >> +    if (!memcmp(x264_string, "x264 - core ", 12))
> >> +        build = atoi(x264_string + 12);
> >> +
> >> +    if (build > 0)
> >> +         h->x264_build = build;
> >> +
> >> +    if (h->avctx->debug & FF_DEBUG_BUGS)
> >> +        av_log(h->avctx, AV_LOG_DEBUG, "x264 version string:\"%s\"\n", 
> >> x264_string);
> >> +skip:
> >> +    for (; i < size; i++)
> >> +        skip_bits(&h->gb, 8);
> > 
> > Why duplicate this?
> > 
> 
> Duplicate what exactly?

This exact same loop is also at the end of
decode_unregistered_user_data()

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

Reply via email to