]> git.sesse.net Git - ffmpeg/commitdiff
avutil/avstring: Limit string length in av_escape to range of int
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 9 Mar 2021 20:17:12 +0000 (21:17 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Mar 2021 05:44:03 +0000 (06:44 +0100)
Otherwise the caller can't distinguish the return value from an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavutil/avstring.c

index e33d4aac5199d6e13c5674f26026c3e727faf02c..832bec750f3e4c62cead0278f2fe6066116210cf 100644 (file)
@@ -337,7 +337,7 @@ int av_escape(char **dst, const char *src, const char *special_chars,
 {
     AVBPrint dstbuf;
 
-    av_bprint_init(&dstbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
+    av_bprint_init(&dstbuf, 1, INT_MAX); /* (int)dstbuf.len must be >= 0 */
     av_bprint_escape(&dstbuf, src, special_chars, mode, flags);
 
     if (!av_bprint_is_complete(&dstbuf)) {