diff --git a/src/transcode.c b/src/transcode.c index 13cbf730..bccd7d02 100644 --- a/src/transcode.c +++ b/src/transcode.c @@ -499,6 +499,10 @@ struct transcoder* transcoder_new(char *flacname) { /* Read some bytes into the internal buffer and into the given buffer. */ int transcoder_read(struct transcoder* trans, char* buff, int offset, int len) { + /* Client asked for more data than exists. */ + if (offset > trans->totalsize) { + return 0; + } if (offset+len > trans->totalsize) { len = trans->totalsize - offset; }