Do not allocate too much space for the mp3 chunk table.
authorAndre Noll <maan@systemlinux.org>
Wed, 11 Feb 2009 21:17:42 +0000 (22:17 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 11 Feb 2009 21:17:42 +0000 (22:17 +0100)
The chunk_table contains an array of uint32_t values.

mp3_afh.c

index 41874b8..932a772 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -403,7 +403,7 @@ static int mp3_read_info(unsigned char *map, size_t numbytes, int fd,
        char *taginfo;
 
        afhi->chunks_total = 0;
-       afhi->chunk_table = para_malloc(chunk_table_size * sizeof(size_t));
+       afhi->chunk_table = para_malloc(chunk_table_size * sizeof(uint32_t));
        taginfo = mp3_get_id3(map, numbytes, fd);
        while (1) {
                unsigned long freq, br, fl;
@@ -433,7 +433,7 @@ static int mp3_read_info(unsigned char *map, size_t numbytes, int fd,
                if (afhi->chunks_total >= chunk_table_size) {
                        chunk_table_size *= 2;
                        afhi->chunk_table = para_realloc(afhi->chunk_table,
-                               chunk_table_size * sizeof(size_t));
+                               chunk_table_size * sizeof(uint32_t));
                }
                afhi->chunk_table[afhi->chunks_total] = fpos;
 //             if (afhi->chunks_total < 10 || !(afhi->chunks_total % 1000))