mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Ensure proper initialization of some variables and arrays in metadata parsing. Fixes FS#11948.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29323 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b5cf163f5a
commit
ae32e1ef06
2 changed files with 8 additions and 7 deletions
|
@ -544,8 +544,8 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
|
||||||
static bool read_mp4_container(int fd, struct mp3entry* id3,
|
static bool read_mp4_container(int fd, struct mp3entry* id3,
|
||||||
uint32_t size_left)
|
uint32_t size_left)
|
||||||
{
|
{
|
||||||
uint32_t size;
|
uint32_t size = 0;
|
||||||
uint32_t type;
|
uint32_t type = 0;
|
||||||
uint32_t handler = 0;
|
uint32_t handler = 0;
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
|
@ -363,7 +363,8 @@ int get_mp3file_info(int fd, struct mp3info *info)
|
||||||
if(header == 0)
|
if(header == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(info, 0, sizeof(struct mp3info));
|
memset(info, 0, sizeof(struct mp3info));
|
||||||
|
memset(frame, 0, sizeof(frame));
|
||||||
#if CONFIG_CODEC==SWCODEC
|
#if CONFIG_CODEC==SWCODEC
|
||||||
/* These two are needed for proper LAME gapless MP3 playback */
|
/* These two are needed for proper LAME gapless MP3 playback */
|
||||||
info->enc_delay = -1;
|
info->enc_delay = -1;
|
||||||
|
@ -460,12 +461,12 @@ int get_mp3file_info(int fd, struct mp3info *info)
|
||||||
}
|
}
|
||||||
#if CONFIG_CODEC==SWCODEC
|
#if CONFIG_CODEC==SWCODEC
|
||||||
i += 21;
|
i += 21;
|
||||||
info->enc_delay = (vbrheader[i] << 4) | (vbrheader[i + 1] >> 4);
|
info->enc_delay = ((int)vbrheader[i ] << 4) | (vbrheader[i+1] >> 4);
|
||||||
info->enc_padding = ((vbrheader[i + 1] & 0x0f) << 8) | vbrheader[i + 2];
|
info->enc_padding = ((int)vbrheader[i+1] << 8) | vbrheader[i+2];
|
||||||
/* TODO: This sanity checking is rather silly, seeing as how the LAME
|
/* TODO: This sanity checking is rather silly, seeing as how the LAME
|
||||||
header contains a CRC field that can be used to verify integrity. */
|
header contains a CRC field that can be used to verify integrity. */
|
||||||
if (!(info->enc_delay >= 0 && info->enc_delay <= 2880 &&
|
if (!(info->enc_delay >= 0 && info->enc_delay <= 2880 &&
|
||||||
info->enc_padding >= 0 && info->enc_padding <= 2*1152))
|
info->enc_padding >= 0 && info->enc_padding <= 2*1152))
|
||||||
{
|
{
|
||||||
/* Invalid data */
|
/* Invalid data */
|
||||||
info->enc_delay = -1;
|
info->enc_delay = -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue