[FFmpeg-cvslog] lavu/parseutils: add trailing characters check in av_parse_video_size()

Stefano Sabatini git at videolan.org
Mon Oct 29 17:45:26 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Oct 29 16:39:13 2012 +0100| [d4604d10fe728f3954b294c0a4373b6df65f4ec9] | committer: Stefano Sabatini

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".

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4604d10fe728f3954b294c0a4373b6df65f4ec9
---

 libavutil/parseutils.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 0a7a622..a335978 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -143,6 +143,10 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
         if (*p)
             p++;
         height = strtol(p, (void*)&p, 10);
+
+        /* trailing extraneous data detected, like in 123x345foobar */
+        if (*p)
+            return AVERROR(EINVAL);
     }
     if (width <= 0 || height <= 0)
         return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list