summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-06 20:53:30 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-08-06 20:55:11 -0400
commit8a8fd3d4a33eaca67669a2b5039c6bb022af2ad3 (patch)
treea398bc3e5e5ea8e1e7ad36970105688394f288e5
parent2008b7d1b085dcc5a03dc242a14c7eef83c7f6f0 (diff)
metadata/mp3data.c set data to 0 in case of read error
Change-Id: I15d4e3d3be4bf4531c892f4351355b0b2e8e0ca9
-rw-r--r--lib/rbcodec/metadata/mp3data.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rbcodec/metadata/mp3data.c b/lib/rbcodec/metadata/mp3data.c
index f30e954e93..664084021c 100644
--- a/lib/rbcodec/metadata/mp3data.c
+++ b/lib/rbcodec/metadata/mp3data.c
@@ -215,10 +215,9 @@ static bool headers_have_same_type(unsigned long header1,
/* Helper function to read 4-byte in big endian format. */
static void read_uint32be_mp3data(int fd, unsigned long *data)
{
-#ifdef ROCKBOX_BIG_ENDIAN
- (void)read(fd, (char*)data, 4);
-#else
+ *data = 0;
(void)read(fd, (char*)data, 4);
+#ifndef ROCKBOX_BIG_ENDIAN
*data = betoh32(*data);
#endif
}