diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 22:40:09 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 22:40:09 -0400 |
commit | 235e41578be60135c8ad682e05440a5b9142ce69 (patch) | |
tree | 797a7aed5d10c2a026feabec5d1e7b99e9646277 | |
parent | 30945f1180962e013c049dcd433697c8a91b1b4c (diff) | |
download | rockbox-235e41578be60135c8ad682e05440a5b9142ce69.tar.gz rockbox-235e41578be60135c8ad682e05440a5b9142ce69.zip |
metadata/mp3data.c init vars & add sanity checks
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
-rw-r--r-- | lib/rbcodec/metadata/mp3data.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rbcodec/metadata/mp3data.c b/lib/rbcodec/metadata/mp3data.c index 664084021c..a6a44851fc 100644 --- a/lib/rbcodec/metadata/mp3data.c +++ b/lib/rbcodec/metadata/mp3data.c | |||
@@ -216,7 +216,9 @@ static bool headers_have_same_type(unsigned long header1, | |||
216 | static void read_uint32be_mp3data(int fd, unsigned long *data) | 216 | static void read_uint32be_mp3data(int fd, unsigned long *data) |
217 | { | 217 | { |
218 | *data = 0; | 218 | *data = 0; |
219 | (void)read(fd, (char*)data, 4); | 219 | unsigned long ret; |
220 | if (read(fd, (char*)&ret, sizeof(ret)) == sizeof(ret)) | ||
221 | *data = ret; | ||
220 | #ifndef ROCKBOX_BIG_ENDIAN | 222 | #ifndef ROCKBOX_BIG_ENDIAN |
221 | *data = betoh32(*data); | 223 | *data = betoh32(*data); |
222 | #endif | 224 | #endif |
@@ -769,7 +771,11 @@ int create_xing_header(int fd, long startpos, long filesize, | |||
769 | last_pos = pos; | 771 | last_pos = pos; |
770 | } | 772 | } |
771 | } | 773 | } |
772 | 774 | else | |
775 | { | ||
776 | memset(toc, 0, sizeof(toc)); | ||
777 | } | ||
778 | |||
773 | /* Use the template header and create a new one. | 779 | /* Use the template header and create a new one. |
774 | We ignore the Protection bit even if the rest of the stream is | 780 | We ignore the Protection bit even if the rest of the stream is |
775 | protected. */ | 781 | protected. */ |