diff mbox series

[FFmpeg-devel] libavformat/mpeg.c: Initialize the buffer uses to read the PTS.

Message ID 20200813212155.2905704-1-tfoucu@gmail.com
State New
Headers show
Series [FFmpeg-devel] libavformat/mpeg.c: Initialize the buffer uses to read the PTS.
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Thierry Foucu Aug. 13, 2020, 9:21 p.m. UTC
Fixed an Use-of-uninitialized-value
---
 libavformat/mpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Aug. 14, 2020, 11:07 p.m. UTC | #1
On Thu, Aug 13, 2020 at 02:21:55PM -0700, Thierry Foucu wrote:
> Fixed an Use-of-uninitialized-value
> ---
>  libavformat/mpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> index 265b2bd1ad..15a768e6e8 100644
> --- a/libavformat/mpeg.c
> +++ b/libavformat/mpeg.c
> @@ -146,7 +146,7 @@ static int mpegps_read_header(AVFormatContext *s)
>  
>  static int64_t get_pts(AVIOContext *pb, int c)
>  {
> -    uint8_t buf[5];
> +    uint8_t buf[5] = {};
>  
>      buf[0] = c < 0 ? avio_r8(pb) : c;
>      avio_read(pb, buf + 1, 4);

this avoids the uninitialized use but it doenst return the correct value
ill post a different solution

thx
[...]
diff mbox series

Patch

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 265b2bd1ad..15a768e6e8 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -146,7 +146,7 @@  static int mpegps_read_header(AVFormatContext *s)
 
 static int64_t get_pts(AVIOContext *pb, int c)
 {
-    uint8_t buf[5];
+    uint8_t buf[5] = {};
 
     buf[0] = c < 0 ? avio_r8(pb) : c;
     avio_read(pb, buf + 1, 4);