diff options
author | Roman Artiukhin <bahusdrive@gmail.com> | 2024-10-19 10:24:27 +0300 |
---|---|---|
committer | Roman Artiukhin <bahusdrive@gmail.com> | 2024-10-19 10:41:23 +0300 |
commit | f3d619601631704a98e2d0f9767e2df2ce6f6bd2 (patch) | |
tree | 721a532ae73cb4e2e4f096e03803414a2ee33066 /lib/rbcodec/metadata/asf.c | |
parent | 8c1c8597ac3c0b43c654ed2fcdfc7320bf6eeb32 (diff) | |
download | rockbox-f3d619601631704a98e2d0f9767e2df2ce6f6bd2.tar.gz rockbox-f3d619601631704a98e2d0f9767e2df2ce6f6bd2.zip |
Codecs: wma: don't fail in case parsing errors in album art
Fixes FS#12576 (album art is not shown but file is now playable)
Change-Id: Idc8e1dcf7b5760b4fd37c43913a534ed4eae512a
Diffstat (limited to 'lib/rbcodec/metadata/asf.c')
-rw-r--r-- | lib/rbcodec/metadata/asf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/rbcodec/metadata/asf.c b/lib/rbcodec/metadata/asf.c index 82c418cc73..f342a473ea 100644 --- a/lib/rbcodec/metadata/asf.c +++ b/lib/rbcodec/metadata/asf.c | |||
@@ -515,17 +515,17 @@ static int asf_parse_header(int fd, struct mp3entry* id3, | |||
515 | /* Expected is either "01 00 xx xx 03 yy yy yy yy" or | 515 | /* Expected is either "01 00 xx xx 03 yy yy yy yy" or |
516 | * "03 yy yy yy yy". xx is the size of the WM/Picture | 516 | * "03 yy yy yy yy". xx is the size of the WM/Picture |
517 | * container in bytes. yy equals the raw data length of | 517 | * container in bytes. yy equals the raw data length of |
518 | * the embedded image. */ | 518 | * the embedded image. |
519 | lseek(fd, -4, SEEK_CUR); | 519 | * |
520 | * Also save position after this tag in file in case any parsing errors */ | ||
521 | uint32_t after_pic_pos = lseek(fd, -4, SEEK_CUR) + 4 + length; | ||
522 | |||
520 | if (read(fd, &type, 1) != 1) | 523 | if (read(fd, &type, 1) != 1) |
521 | type = 0; | 524 | type = 0; |
522 | 525 | ||
523 | if (type == 1) { | 526 | if (type == 1) { |
524 | lseek(fd, 3, SEEK_CUR); | 527 | lseek(fd, 3, SEEK_CUR); |
525 | read(fd, &type, 1); | 528 | read(fd, &type, 1); |
526 | /* In case the parsing will fail in the next step we | ||
527 | * might at least be able to skip the whole section. */ | ||
528 | datalength = length - 1; | ||
529 | } | 529 | } |
530 | if (type == 3) { | 530 | if (type == 3) { |
531 | /* Read the raw data length of the embedded image. */ | 531 | /* Read the raw data length of the embedded image. */ |
@@ -570,7 +570,7 @@ static int asf_parse_header(int fd, struct mp3entry* id3, | |||
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | lseek(fd, datalength, SEEK_CUR); | 573 | lseek(fd, after_pic_pos, SEEK_SET); |
574 | #endif | 574 | #endif |
575 | } else if (!strncmp("replaygain_", utf8buf, 11)) { | 575 | } else if (!strncmp("replaygain_", utf8buf, 11)) { |
576 | char *value = id3buf; | 576 | char *value = id3buf; |