diff mbox series

[FFmpeg-devel,4/8] avutil/avstring: Limit string length in av_escape to range of int

Message ID 20210310010601.1142819-4-andreas.rheinhardt@gmail.com
State Accepted
Commit c2649d5196843db46d25a9f9f6f9272a464221b7
Headers show
Series [FFmpeg-devel,1/8] avcodec/cbs: Remove redundant checks for CodedBitstreamContext.codec | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt March 10, 2021, 1:05 a.m. UTC
Otherwise the caller can't distinguish the return value from an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavutil/avstring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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)) {