[FFmpeg-cvslog] avutil/avsscanf: fix possible overreads when dealing with %c or %s

Paul B Mahol git at videolan.org
Wed Dec 2 14:56:59 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Dec  2 13:46:22 2020 +0100| [13df9bfbcb404e90933c5bb7d8a7fe04f506e3bd] | committer: Paul B Mahol

avutil/avsscanf: fix possible overreads when dealing with %c or %s

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

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

diff --git a/libavutil/avsscanf.c b/libavutil/avsscanf.c
index 850c117940..b7f0f71c2d 100644
--- a/libavutil/avsscanf.c
+++ b/libavutil/avsscanf.c
@@ -113,7 +113,7 @@ static int ffshgetc(FFFILE *f)
 }
 
 #define shlim(f, lim) ffshlim((f), (lim))
-#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : ffshgetc(f))
+#define shgetc(f) (((f)->rpos < (f)->shend) ? *(f)->rpos++ : ffshgetc(f))
 #define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0)
 
 static const unsigned char table[] = { -1,



More information about the ffmpeg-cvslog mailing list