demux: add sanity checks to packet allocation functions
commit757e43c3f863453e5d17e4201c7c9ae2a58c5844
authorUoti Urpala <uau@glyph.nonexistent.invalid>
Mon, 17 Jan 2011 14:16:39 +0000 (17 16:16 +0200)
committerUoti Urpala <uau@glyph.nonexistent.invalid>
Mon, 17 Jan 2011 14:16:39 +0000 (17 16:16 +0200)
tree81b6481f0df577dbacfb6b9feca2fca377e912d8
parente342a81d6f5d13b83753050af79feab4fd702925
demux: add sanity checks to packet allocation functions

Change new_demux_packet() and resize_demux_packet() length parameter
type from int to size_t and add a check to abort() if the size is over
1 GB. This should make integer overflow problems leading to memory
corruption in demuxers less likely; and aborting should be no worse
than insane memory consumption. Also make the functions abort() if the
actual allocation fails instead of trying to continue with a
zero-sized buffer.
libmpdemux/demuxer.c
libmpdemux/demuxer.h