[FFmpeg-cvslog] lavc/libx264.c: Fix possible UB by NULL pointer LHS

Michael Goulet git at videolan.org
Mon Jun 20 12:08:58 EEST 2022


ffmpeg | branch: master | Michael Goulet <mgoulet at fb.com> | Thu Jun 16 17:52:56 2022 +0200| [0aa5dd084b8e26c9d644354c42c9252cf3b19cea] | committer: Thilo Borgmann

lavc/libx264.c: Fix possible UB by NULL pointer LHS

It is UB to attempt to do pointer arithmetic on NULL pointer LHS, even if that pointer arithmetic ends up being "+= 0" (i.e. !!p == 0 if p == NULL).

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

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

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 14177b3016..616d855067 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -940,7 +940,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
                     return ret;
             }
             p= strchr(p, ':');
-            p+=!!p;
+            if (p) {
+                ++p;
+            }
         }
     }
 



More information about the ffmpeg-cvslog mailing list