summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Viehmann <tv@beamnet.de>2008-12-31 22:47:32 +0100
committerThomas Viehmann <tv@beamnet.de>2008-12-31 22:47:32 +0100
commit475c79b11056e35dd0716408cd2f1499577b9421 (patch)
tree87bd9af4fc4d18e03e23c6786791461744f7ad5a /src
parentbce49846158d839f0fe5185d9956edd1492f9fc3 (diff)
downloadxine-lib-475c79b11056e35dd0716408cd2f1499577b9421.tar.gz
xine-lib-475c79b11056e35dd0716408cd2f1499577b9421.tar.bz2
check for negative return values of read when demuxing mng streams
Some input plugins (e.g. file) return negative error codes from read, this should be treated as no (more) data available. This is particularly bad because the error code is assigned to an unsigned integer variable for use by the caller. Based on a patch by Matthias Hopf <mhopf@suse.de>
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_mng.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c
index b57a349c5..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;
}