* [FFmpeg-devel] [PATCH] lavfi/af_pan: fix sscanf return value check
@ 2023-12-01 9:08 Nicolas George
2023-12-01 10:40 ` Paul B Mahol
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas George @ 2023-12-01 9:08 UTC (permalink / raw)
To: ffmpeg-devel
sscanf() can return -1 when it reach the end of the string.
Fix track ticket #10677.
Signed-off-by: Nicolas George <george@nsup.org>
---
libavfilter/af_pan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index cfed9f146a..9ab827b396 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -69,7 +69,7 @@ static int parse_channel_name(char **arg, int *rchannel, int *rnamed)
skip_spaces(arg);
/* try to parse a channel name, e.g. "FL" */
- if (sscanf(*arg, "%7[A-Z]%n", buf, &len)) {
+ if (sscanf(*arg, "%7[A-Z]%n", buf, &len) >= 1) {
channel_id = av_channel_from_string(buf);
if (channel_id < 0)
return channel_id;
@@ -80,7 +80,7 @@ static int parse_channel_name(char **arg, int *rchannel, int *rnamed)
return 0;
}
/* try to parse a channel number, e.g. "c2" */
- if (sscanf(*arg, "c%d%n", &channel_id, &len) &&
+ if (sscanf(*arg, "c%d%n", &channel_id, &len) >= 1 &&
channel_id >= 0 && channel_id < MAX_CHANNELS) {
*rchannel = channel_id;
*rnamed = 0;
@@ -165,7 +165,7 @@ static av_cold int init(AVFilterContext *ctx)
sign = 1;
while (1) {
gain = 1;
- if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
+ if (sscanf(arg, "%lf%n *%n", &gain, &len, &len) >= 1)
arg += len;
if (parse_channel_name(&arg, &in_ch_id, &named)){
av_log(ctx, AV_LOG_ERROR,
--
2.42.0
_______________________________________________
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:[~2023-12-04 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 9:08 [FFmpeg-devel] [PATCH] lavfi/af_pan: fix sscanf return value check Nicolas George
2023-12-01 10:40 ` Paul B Mahol
2023-12-04 16:12 ` Paul B Mahol
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