mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
metadata: opus, vorbis, speex: Fix 0 is supplied as base64 char when parsing album art metadata
For some reason it caused a crash on asan enabled simulator builds but worked fine otherwise. Fixup for0847bcc1
andac8714dd
Change-Id: Iff1c2779d5fa6889c743cdccd8e1feaf55684394
This commit is contained in:
parent
b6f8f31b7c
commit
849e8abe8d
1 changed files with 5 additions and 5 deletions
|
@ -326,14 +326,14 @@ size_t base64_decode(const char *in, size_t in_len, unsigned char *out)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
int index = in[i] - B64_START_CHAR;
|
||||
if (index < 0 || index >= (int)ARRAYLEN(b64_codes))
|
||||
#ifdef SIMULATOR
|
||||
if (index < 0 || index >= (int)ARRAYLEN(b64_codes) || b64_codes[index] < 0)
|
||||
{
|
||||
out[len] = '\0';
|
||||
DEBUGF("Invalid base64 char: '%c', char code: %i.\n", in[i], in[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
val = (val << 6) | b64_codes[index];
|
||||
|
||||
if ((++i & 3) == 0)
|
||||
|
@ -429,7 +429,7 @@ long read_vorbis_tags(int fd, struct mp3entry *id3,
|
|||
int after_block_pos = lseek(fd, 0, SEEK_CUR);
|
||||
|
||||
char* buf = id3->path;
|
||||
size_t outlen = base64_decode(buf, MIN(read_len, (int32_t) sizeof(id3->path)), buf);
|
||||
size_t outlen = base64_decode(buf, MIN(read_len, (int32_t) sizeof(id3->path) - 1), buf);
|
||||
|
||||
int picframe_pos;
|
||||
parse_flac_album_art(buf, outlen, &id3->albumart.type, &picframe_pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue