[FFmpeg-cvslog] tiff/doubles2str: check for truncation

Michael Niedermayer git at videolan.org
Sun Sep 9 14:48:46 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep  9 14:41:18 2012 +0200| [17f9626b5dd86085a155922221f41338bc8bba1f] | committer: Michael Niedermayer

tiff/doubles2str: check for truncation

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/tiff.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index b0ffd7b..078c29a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -215,7 +215,9 @@ static char *doubles2str(double *dp, int count, const char *sep)
     ap0   = ap;
     ap[0] = '\0';
     for (i = 0; i < count; i++) {
-        int l = snprintf(ap, component_len, "%f%s", dp[i], sep);
+        unsigned l = snprintf(ap, component_len, "%f%s", dp[i], sep);
+        if(l >= component_len)
+            return NULL;
         ap += l;
     }
     ap0[strlen(ap0) - strlen(sep)] = '\0';



More information about the ffmpeg-cvslog mailing list