From e878464716557be1553858a31e93a387e23c088a Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Thu, 31 Aug 2006 00:37:16 +0000 Subject: [PATCH] Fix for bad seeks on wma subheaders --- src/scan-wma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scan-wma.c b/src/scan-wma.c index 6f275e0c..6185e487 100644 --- a/src/scan-wma.c +++ b/src/scan-wma.c @@ -348,6 +348,7 @@ int wma_parse_header_extension(int fd, int size, MP3FILE *pmp3) { WMA_SUBHEADER sh; WMA_GUID *pguid; long bytes_left; + off_t current; if(r_read(fd,&he,sizeof(he)) != sizeof(he)) return FALSE; @@ -357,6 +358,8 @@ int wma_parse_header_extension(int fd, int size, MP3FILE *pmp3) { while(bytes_left) { /* read in a subheader */ + current = lseek(fd,0,SEEK_CUR); + if(r_read(fd,&sh,sizeof(sh)) != sizeof(sh)) return FALSE; @@ -383,12 +386,14 @@ int wma_parse_header_extension(int fd, int size, MP3FILE *pmp3) { } DPRINTF(E_DBG,L_SCAN," Size: %ld\n",sh.size); + if(sh.size <= sizeof(sh)) + return TRUE; /* guess we're done! */ bytes_left -= sh.size; - lseek(fd,sh.size - sizeof(sh),SEEK_CUR); + lseek(fd,current + sh.size,SEEK_SET); } - return 1; + return TRUE; }