As it is implemented right now, OGG pages are not treated properly, so in case of huge embedded pictures inside metadata the file could end up ignore by audio/readtags and audio/mkplist. Workaround by ignoring tags that span across pages for now.
Unified · Split
| @@ -5,10 +5,10 @@ tagopus(Tagctx *ctx) · 4 unmodified lines | ||
| 5 | 5 | { |
| 6 | 6 | char *v; |
| 7 | 7 | uchar *d, h[4]; |
| 8 | − int sz, numtags, i, npages; | |
| 8 | + int sz, numtags, i, npages, pgend; | |
| 9 | 9 | |
| 10 | 10 | d = (uchar*)ctx->buf; |
| 11 | − for(npages = 0; npages < 2; npages++){ | |
| 11 | + for(npages = pgend = 0; npages < 2; npages++){ | |
| 12 | 12 | int nsegs; |
| 13 | 13 | if(ctx->read(ctx, d, 27) != 27) |
| 14 | 14 | return -1; |
| @@ -28,6 +28,8 @@ tagopus(Tagctx *ctx) · 13 unmodified lines | ||
| 28 | 28 | ctx->channels = d[1]; |
| 29 | 29 | ctx->samplerate = leuint(&d[4]); |
| 30 | 30 | }else if(memcmp(&d[nsegs], "OpusTags", 8) == 0){ |
| 31 | + /* FIXME - embedded pics make tags span multiple packets */ | |
| 32 | + pgend = ctx->seek(ctx, 0, 1) + sz; | |
| 31 | 33 | break; |
| 32 | 34 | } |
| 33 | 35 | |
| @@ -47,6 +49,9 @@ tagopus(Tagctx *ctx) · 13 unmodified lines | ||
| 47 | 49 | return -1; |
| 48 | 50 | if((sz = leuint(h)) < 0) |
| 49 | 51 | return -1; |
| 52 | + /* FIXME - embedded pics make tags span multiple packets */ | |
| 53 | + if(pgend < ctx->seek(ctx, 0, 1)+sz) | |
| 54 | + break; | |
| 50 | 55 | |
| 51 | 56 | if(ctx->bufsz < sz+1){ |
| 52 | 57 | if(ctx->seek(ctx, sz, 1) < 0) |
| @@ -37,11 +37,11 @@ tagvorbis(Tagctx *ctx) · 36 unmodified lines | ||
| 37 | 37 | { |
| 38 | 38 | char *v; |
| 39 | 39 | uchar *d, h[4]; |
| 40 | − int sz, numtags, i, npages; | |
| 40 | + int sz, numtags, i, npages, pgend; | |
| 41 | 41 | |
| 42 | 42 | d = (uchar*)ctx->buf; |
| 43 | 43 | /* need to find vorbis frame with type=3 */ |
| 44 | − for(npages = 0; npages < 2; npages++){ /* vorbis comment is the second header */ | |
| 44 | + for(npages = pgend = 0; npages < 2; npages++){ /* vorbis comment is the second header */ | |
| 45 | 45 | int nsegs; |
| 46 | 46 | if(ctx->read(ctx, d, 27) != 27) |
| 47 | 47 | return -1; |
| @@ -54,8 +54,11 @@ tagvorbis(Tagctx *ctx) · 6 unmodified lines | ||
| 54 | 54 | return -1; |
| 55 | 55 | for(sz = i = 0; i < nsegs; sz += d[i++]); |
| 56 | 56 | |
| 57 | − if(d[nsegs] == 3) /* comment */ | |
| 57 | + if(d[nsegs] == 3){ /* comment */ | |
| 58 | + /* FIXME - embedded pics make tags span multiple packets */ | |
| 59 | + pgend = ctx->seek(ctx, 0, 1) + sz; | |
| 58 | 60 | break; |
| 61 | + } | |
| 59 | 62 | if(d[nsegs] == 1 && sz >= 28){ /* identification */ |
| 60 | 63 | if(ctx->read(ctx, d, 28) != 28) |
| 61 | 64 | return -1; |
| @@ -82,6 +85,9 @@ tagvorbis(Tagctx *ctx) · 20 unmodified lines | ||
| 82 | 85 | return -1; |
| 83 | 86 | if((sz = leuint(h)) < 0) |
| 84 | 87 | return -1; |
| 88 | + /* FIXME - embedded pics make tags span multiple packets */ | |
| 89 | + if(pgend < ctx->seek(ctx, 0, 1)+sz) | |
| 90 | + break; | |
| 85 | 91 | |
| 86 | 92 | if(ctx->bufsz < sz+1){ |
| 87 | 93 | if(ctx->seek(ctx, sz, 1) < 0) |