shithub: libtags

Download patch

ref: a5c61d42cf4fde51a09e605c0792852fc131ddec
parent: a64636173e0d162d0e9e36d40fad32d1bc56898b
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Feb 19 12:52:30 EST 2024

wav: don't stop on data (tags may follow after); don't stop after 8 sections either

--- a/wav.c
+++ b/wav.c
@@ -26,7 +26,7 @@
 
 	sz = 1;
 	info = 0;
-	for(i = 0; i < 8 && sz > 0; i++){
+	for(i = 0; sz > 0; i++){
 		if(ctx->read(ctx, d, 4+4+(i?0:4)) != 4+4+(i?0:4))
 			return -1;
 		if(i == 0){
@@ -66,10 +66,7 @@
 		}else if(memcmp(d, "LIST", 4) == 0){
 			sz = csz - 4;
 			continue;
-		}else if(memcmp(d, "data", 4) == 0){
-			break;
 		}else if(info){
-			csz++;
 			for(n = 0; n < nelem(t); n++){
 				if(memcmp(d, t[n].s, 4) == 0){
 					if(ctx->read(ctx, d, csz) != (int)csz)
@@ -80,6 +77,8 @@
 					break;
 				}
 			}
+			if(n < nelem(t))
+				continue;
 		}
 
 		if(ctx->seek(ctx, csz, 1) < 0)