[FFmpeg-cvslog] avutil/avstring: Limit string length in av_escape to range of int

Andreas Rheinhardt git at videolan.org
Mon Mar 15 08:01:56 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Mar  9 21:17:12 2021 +0100| [c2649d5196843db46d25a9f9f6f9272a464221b7] | committer: Andreas Rheinhardt

avutil/avstring: Limit string length in av_escape to range of int

Otherwise the caller can't distinguish the return value from an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavutil/avstring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index e33d4aac51..832bec750f 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -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)) {



More information about the ffmpeg-cvslog mailing list