On Sat, Nov 20, 2010 at 06:38:56PM +0100, Reimar D?ffinger wrote:
On Sat, Nov 20, 2010 at 05:14:25PM +0100, Michael Niedermayer wrote:
@@ -48,7 +49,7 @@ int av_new_packet(AVPacket *pkt, int size) { uint8_t *data= NULL; - if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) + if((unsigned)size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (data){ memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
i think av_malloc alraedy protects us against this, that said if you prefer then this change is surely ok as a seperate commit
I didn't like the idea of relying on it, also because av_malloc at least currently uses a hardcoded "16" (which I suspect is for the "memalign hack" version) and not FF_INPUT_BUFFER_PADDING_SIZE.
int av_dup_packet(AVPacket *pkt) { if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
that should also be seperate from xan/wc* ideally
Yes, I will of course commit the separately, first the extra av_new_packet check, then the grow_packet, then the append function and last the wc3 change was the plan.
Index: libavformat/avformat.h =================================================================== --- libavformat/avformat.h (revision 25774) +++ libavformat/avformat.h (working copy) @@ -245,6 +245,17 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
+/** + * Reads data and appends it to the current content of the AVPacket. + * If pkt->size is 0 it behaves like av_get_packet.
This should mention that its inefficient and better to allocate a correctly sized packet
Done. More comments?
no further comments from me [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator