summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mng.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2009-01-05 14:50:58 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2009-01-05 14:50:58 +0000
commit5347abe5764b0a0ff3ef1d357ce9934a425758fa (patch)
tree16114922f1fe3862535ef1898da393648522d48b /src/demuxers/demux_mng.c
parent0907a74b5fa7b8b439f1f8f5db239c7586bfb12d (diff)
parent8f725b5644ac910294fbe28929ddc98cd1d2ad38 (diff)
downloadxine-lib-5347abe5764b0a0ff3ef1d357ce9934a425758fa.tar.gz
xine-lib-5347abe5764b0a0ff3ef1d357ce9934a425758fa.tar.bz2
Merge security fixes.
Diffstat (limited to 'src/demuxers/demux_mng.c')
-rw-r--r--src/demuxers/demux_mng.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c
index 0fcdb24ff..d0d83ff80 100644
--- a/src/demuxers/demux_mng.c
+++ b/src/demuxers/demux_mng.c
@@ -104,7 +104,12 @@ static mng_bool mymng_close_stream(mng_handle mngh){
static mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
- *bytesread = this->input->read(this->input, buffer, size);
+ off_t n = this->input->read(this->input, buffer, size);
+ if (n < 0) {
+ *bytesread = 0;
+ return MNG_FALSE;
+ }
+ *bytesread = n;
return MNG_TRUE;
}
@@ -112,6 +117,9 @@ static mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 si
static mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
+ if (width > 0x8000 || height > 0x8000)
+ return MNG_FALSE;
+
this->bih.biWidth = (width + 7) & ~7;
this->bih.biHeight = height;
this->left_edge = (this->bih.biWidth - width) / 2;