Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-06-01 Thread Michael Niedermayer
On Wed, May 25, 2016 at 05:58:33PM +0300, Andriy Lysnevych wrote: > > data_offset should probably be size_t, thats also what offsetof() would > > give > > a pointer difference can be larger than INT_MAX > > Done > > > also please add a av_assert0 that pkt->data is not NULL or handle that > > case

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-25 Thread Andriy Lysnevych
> data_offset should probably be size_t, thats also what offsetof() would > give > a pointer difference can be larger than INT_MAX Done > also please add a av_assert0 that pkt->data is not NULL or handle that > case Done NULL data handling but it makes code more complex. Please check. > as pkt-

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-25 Thread Michael Niedermayer
On Wed, May 25, 2016 at 01:01:27PM +0300, Andriy Lysnevych wrote: > You are right. Please review updated patch. > avpacket.c | 19 --- > 1 file changed, 12 insertions(+), 7 deletions(-) > 44aa8ad5f855c68cbed7da06dbf2be888ede301d > 0001-Respect-payload-offset-in-av_grow_packet.

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-25 Thread Andriy Lysnevych
You are right. Please review updated patch. From 62b31fa4b05fc600eada4fb28b352e5b87bd60f8 Mon Sep 17 00:00:00 2001 From: Andriy Lysnevych Date: Wed, 25 May 2016 12:55:39 +0300 Subject: [PATCH] Respect payload offset in av_grow_packet --- libavcodec/avpacket.c | 19 --- 1 file cha

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-24 Thread Michael Niedermayer
On Tue, May 24, 2016 at 12:32:19PM +0300, Andriy Lysnevych wrote: > This one removed: > > >> -if (!pkt->size) > >> -return av_new_packet(pkt, grow_by); > > pkt->size can be 0 but reference-counted buf allocated. av_new_packet > leads to memory leak in this case. (FIXME?) > > >> -

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-24 Thread Andriy Lysnevych
This one removed: >> -if (!pkt->size) >> -return av_new_packet(pkt, grow_by); pkt->size can be 0 but reference-counted buf allocated. av_new_packet leads to memory leak in this case. (FIXME?) >> -if ((unsigned)grow_by > >> -INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_S

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Michael Niedermayer
On Mon, May 16, 2016 at 12:25:00PM +0300, Andriy Lysnevych wrote: > Sorry, looks like problems with my mail client. Sending patch as attachment. > avpacket.c | 25 +++-- > 1 file changed, 15 insertions(+), 10 deletions(-) > 7afc9ec25e99e6106402207ce30714a3e65a9639 > 0001-R

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Andriy Lysnevych
Sorry, looks like problems with my mail client. Sending patch as attachment. From 45f69d7f02928ad8abae3fc591082997590c597a Mon Sep 17 00:00:00 2001 From: Andriy Lysnevych Date: Mon, 16 May 2016 12:08:33 +0300 Subject: [PATCH] Respect payload offset in av_grow_packet --- libavcodec/avpacket.c | 2

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-16 Thread Andriy Lysnevych
Patch for latest master --- libavcodec/avpacket.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index bcc7c79..327cd41 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -110,24 +110,29

Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-14 Thread Michael Niedermayer
On Fri, May 13, 2016 at 03:15:07PM +0300, Andriy Lysnevych wrote: > The patch fixes the function when used with reference-counted packets > that have payload offset. > > Also this function is dangerous for not reference-counted packets > because it just overwrites pkt->data. Probably it is better

[FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-13 Thread Andriy Lysnevych
The patch fixes the function when used with reference-counted packets that have payload offset. Also this function is dangerous for not reference-counted packets because it just overwrites pkt->data. Probably it is better to restrict using it with not referenced-counted packets because you simply