diff mbox

[FFmpeg-devel] lavc/avpacket: Initialize a variable in error path

Message ID 201702170049.05480.cehoyos@ag.or.at
State Accepted
Commit 1d54be215309b8aa71a51826e4b0a1660fef9f93
Headers show

Commit Message

Carl Eugen Hoyos Feb. 16, 2017, 11:49 p.m. UTC
Hi!

Attached patch is said to fix undefined behaviour, see ticket #6153, I cannot 
reproduce.

Please comment, Carl Eugen
From 8bbd58c465deb28737586c9292d57ab75e3de32c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Fri, 17 Feb 2017 00:46:14 +0100
Subject: [PATCH] lavc/avpacket: Initialize a variable in error path.

Fixes ticket #6153.
---
 libavcodec/avpacket.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Feb. 17, 2017, 12:42 a.m. UTC | #1
On Fri, Feb 17, 2017 at 12:49:05AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch is said to fix undefined behaviour, see ticket #6153, I cannot 
> reproduce.
> 
> Please comment, Carl Eugen

patch is ok
the issue described is real but a bit hypothetical and probably has
no real world effect
i suggest to backport this too though because its likely easy to
backport

thanks

[...]
Carl Eugen Hoyos Feb. 17, 2017, 9:53 a.m. UTC | #2
2017-02-17 1:42 GMT+01:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Fri, Feb 17, 2017 at 12:49:05AM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch is said to fix undefined behaviour, see ticket #6153,
>> I cannot reproduce.
>>
>> Please comment, Carl Eugen
>
> patch is ok

Patch pushed and backported.

> the issue described is real but a bit hypothetical and probably has
> no real world effect

I don't understand how the issue can be triggered...

Thank you, Carl Eugen
Michael Niedermayer Feb. 17, 2017, 6:45 p.m. UTC | #3
On Fri, Feb 17, 2017 at 10:53:26AM +0100, Carl Eugen Hoyos wrote:
> 2017-02-17 1:42 GMT+01:00 Michael Niedermayer <michael@niedermayer.cc>:
> > On Fri, Feb 17, 2017 at 12:49:05AM +0100, Carl Eugen Hoyos wrote:
> >> Hi!
> >>
> >> Attached patch is said to fix undefined behaviour, see ticket #6153,
> >> I cannot reproduce.
> >>
> >> Please comment, Carl Eugen
> >
> > patch is ok
> 
> Patch pushed and backported.
> 

> > the issue described is real but a bit hypothetical and probably has
> > no real world effect
> 
> I don't understand how the issue can be triggered...

a compiler can optimize it out, i would expect it to need -O0
also iam not sure what ubsan exactly considers an issue, depending on
that it may be random if it can be reproduced
didnt try or see the exact ubsan error


[...]
diff mbox

Patch

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 24b4efb..8e028a2 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -348,6 +348,8 @@  uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
             return pkt->side_data[i].data;
         }
     }
+    if (size)
+        *size = 0;
     return NULL;
 }