lavu/parseutils: add trailing characters check in av_parse_video_size()

Return an error in case the video size specifications contains spurious
trailing chars, like in "320x240foobar".
This commit is contained in:
Stefano Sabatini 2012-10-29 16:39:13 +01:00
parent adf0cd1456
commit d4604d10fe
1 changed files with 4 additions and 0 deletions

View File

@ -143,6 +143,10 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
if (*p) if (*p)
p++; p++;
height = strtol(p, (void*)&p, 10); height = strtol(p, (void*)&p, 10);
/* trailing extraneous data detected, like in 123x345foobar */
if (*p)
return AVERROR(EINVAL);
} }
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
return AVERROR(EINVAL); return AVERROR(EINVAL);