* [FFmpeg-devel] [PATCH] lavc/libx264.c: Fix possible UB by NULL pointer LHS
@ 2022-06-16 15:58 Thilo Borgmann
2022-06-16 20:01 ` Michael Niedermayer
0 siblings, 1 reply; 3+ messages in thread
From: Thilo Borgmann @ 2022-06-16 15:58 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 73 bytes --]
Hi,
the LHS pointer might be NULL so that += would be UB.
Thanks,
Thilo
[-- Attachment #2: 0001-lavc-libx264.c-Fix-possible-UB-by-NULL-pointer-LHS.patch --]
[-- Type: text/plain, Size: 877 bytes --]
From cfb7ce8092c34436fae3120645aa96fe082af4ea Mon Sep 17 00:00:00 2001
From: Michael Goulet <mgoulet@fb.com>
Date: Thu, 16 Jun 2022 17:52:56 +0200
Subject: [PATCH] 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).
---
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;
+ }
}
}
--
2.20.1 (Apple Git-117)
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavc/libx264.c: Fix possible UB by NULL pointer LHS
2022-06-16 15:58 [FFmpeg-devel] [PATCH] lavc/libx264.c: Fix possible UB by NULL pointer LHS Thilo Borgmann
@ 2022-06-16 20:01 ` Michael Niedermayer
2022-06-20 9:09 ` Thilo Borgmann
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2022-06-16 20:01 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1115 bytes --]
On Thu, Jun 16, 2022 at 05:58:09PM +0200, Thilo Borgmann wrote:
> Hi,
>
> the LHS pointer might be NULL so that += would be UB.
>
> Thanks,
> Thilo
> libx264.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 558de1ca7a30aa728193297a7d605c051b5bbfc0 0001-lavc-libx264.c-Fix-possible-UB-by-NULL-pointer-LHS.patch
> From cfb7ce8092c34436fae3120645aa96fe082af4ea Mon Sep 17 00:00:00 2001
> From: Michael Goulet <mgoulet@fb.com>
> Date: Thu, 16 Jun 2022 17:52:56 +0200
> Subject: [PATCH] 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).
> ---
> libavcodec/libx264.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
should be ok
[...]
thx
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavc/libx264.c: Fix possible UB by NULL pointer LHS
2022-06-16 20:01 ` Michael Niedermayer
@ 2022-06-20 9:09 ` Thilo Borgmann
0 siblings, 0 replies; 3+ messages in thread
From: Thilo Borgmann @ 2022-06-20 9:09 UTC (permalink / raw)
To: ffmpeg-devel
Am 16.06.22 um 22:01 schrieb Michael Niedermayer:
> On Thu, Jun 16, 2022 at 05:58:09PM +0200, Thilo Borgmann wrote:
>> Hi,
>>
>> the LHS pointer might be NULL so that += would be UB.
>>
>> Thanks,
>> Thilo
>
>> libx264.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>> 558de1ca7a30aa728193297a7d605c051b5bbfc0 0001-lavc-libx264.c-Fix-possible-UB-by-NULL-pointer-LHS.patch
>> From cfb7ce8092c34436fae3120645aa96fe082af4ea Mon Sep 17 00:00:00 2001
>> From: Michael Goulet <mgoulet@fb.com>
>> Date: Thu, 16 Jun 2022 17:52:56 +0200
>> Subject: [PATCH] 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).
>> ---
>> libavcodec/libx264.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> should be ok
Pushed, thanks!
-Thilo
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-20 9:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 15:58 [FFmpeg-devel] [PATCH] lavc/libx264.c: Fix possible UB by NULL pointer LHS Thilo Borgmann
2022-06-16 20:01 ` Michael Niedermayer
2022-06-20 9:09 ` Thilo Borgmann
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git