diff mbox series

[FFmpeg-devel,1/2] avformat/hlsenc: Remove nonsense memset

Message ID AM7PR03MB66600DECA89D8A1FFBDAEBEA8F939@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 7596b6530d5f00ea0510b5c698714c76369811e7
Headers show
Series [FFmpeg-devel,1/2] avformat/hlsenc: Remove nonsense memset | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 10, 2021, 12:59 p.m. UTC
The memset here is both unnecessary (avio_read() ignores the previous
content of the destination buffer) as well as nonsense (for a char
buf[BUFSIZE] sizeof(buf) and sizeof(BUFSIZE) are not the same; the
latter is sizeof(int)).
Fixes Coverity issue #1465863.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/hlsenc.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Steven Liu Nov. 11, 2021, 2:25 a.m. UTC | #1
> 2021年11月10日 下午8:59,Andreas Rheinhardt <andreas.rheinhardt@outlook.com> 写道:
> 
> The memset here is both unnecessary (avio_read() ignores the previous
> content of the destination buffer) as well as nonsense (for a char
> buf[BUFSIZE] sizeof(buf) and sizeof(BUFSIZE) are not the same; the
> latter is sizeof(int)).
> Fixes Coverity issue #1465863.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavformat/hlsenc.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 98608a834a..557cf1bee3 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2382,7 +2382,6 @@ static int64_t append_single_file(AVFormatContext *s, VariantStream *vs)
>     }
> 
>     do {
> -        memset(buf, 0, sizeof(BUFSIZE));
>         read_byte = avio_read(vs->out, buf, BUFSIZE);
>         avio_write(vs->out_single_file, buf, read_byte);
>         if (read_byte > 0) {
> -- 
> 2.30.2
> 
> _______________________________________________
> 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".
> 

Patchset test ok,  LGTM


Thanks

Steven Liu
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 98608a834a..557cf1bee3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2382,7 +2382,6 @@  static int64_t append_single_file(AVFormatContext *s, VariantStream *vs)
     }
 
     do {
-        memset(buf, 0, sizeof(BUFSIZE));
         read_byte = avio_read(vs->out, buf, BUFSIZE);
         avio_write(vs->out_single_file, buf, read_byte);
         if (read_byte > 0) {