ref: b4cdfcc760394cec9a33647b7acd272c91397ccc
parent: 9d825963310c744e8bd2c8ca03b7cdc99aae898e
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Sun Jan 27 01:30:48 EST 2013
Fix a typo in op_mem_read(). We should copy the minimum of the buffer size and the remaining bytes, not the maximum. Fixes #1927.
--- a/src/stream.c
+++ b/src/stream.c
@@ -110,7 +110,7 @@
/*Check for EOF.*/
if(pos>=size)return 0;
/*Check for a short read.*/
- _buf_size=(int)OP_MAX(size-pos,_buf_size);
+ _buf_size=(int)OP_MIN(size-pos,_buf_size);
memcpy(_ptr,stream->data+pos,_buf_size);
pos+=_buf_size;
stream->pos=pos;