diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-10-11 22:53:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-10-11 22:53:08 +0000 |
commit | c61e462ae3b0c0a82a1b3d1aaf4a146c8936c58d (patch) | |
tree | 686d9477171b6db9b73dece7b1f7bd04620c1e2f /apps | |
parent | 83ec896586c17146ed908e218fbb828392e12486 (diff) | |
download | rockbox-c61e462ae3b0c0a82a1b3d1aaf4a146c8936c58d.tar.gz rockbox-c61e462ae3b0c0a82a1b3d1aaf4a146c8936c58d.zip |
read_mp4_tag_string() may return a NULL in the pointer so no code should rely
on the pointer being valid unless the return code is checked. This lead to the
year_string being accessed with atoi() even when being NULL => crash. This
fixes FS#7937.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15080 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/metadata/mp4.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 6f9383fd5d..4a1fba11c2 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c | |||
@@ -402,17 +402,21 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3, | |||
402 | 402 | ||
403 | case MP4_cday: | 403 | case MP4_cday: |
404 | read_mp4_tag_string(fd, size, &buffer, &buffer_left, | 404 | read_mp4_tag_string(fd, size, &buffer, &buffer_left, |
405 | &id3->year_string); | 405 | &id3->year_string); |
406 | 406 | ||
407 | /* Try to parse it as a year, for the benefit of the database. | 407 | /* Try to parse it as a year, for the benefit of the database. |
408 | */ | 408 | */ |
409 | id3->year = atoi(id3->year_string); | 409 | if(id3->year_string) |
410 | |||
411 | if (id3->year < 1900) | ||
412 | { | 410 | { |
413 | id3->year = 0; | 411 | id3->year = atoi(id3->year_string); |
412 | if (id3->year < 1900) | ||
413 | { | ||
414 | id3->year = 0; | ||
415 | } | ||
414 | } | 416 | } |
415 | 417 | else | |
418 | id3->year = 0; | ||
419 | |||
416 | break; | 420 | break; |
417 | 421 | ||
418 | case MP4_gnre: | 422 | case MP4_gnre: |