]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/aaxdec.c
avutil/buffer: Switch AVBuffer API to size_t
[ffmpeg] / libavformat / aaxdec.c
index cfd2e10a15703fb28c06f0e772390395402ed480..c6d2d1c8d1151ff56b75b1bd2a63b85de0235208 100644 (file)
@@ -51,7 +51,7 @@ typedef struct AAXContext {
     int64_t strings_size;
     char *string_table;
 
-    int current_segment;
+    uint32_t current_segment;
 
     AAXColumn *xcolumns;
     AAXSegment *segments;
@@ -232,14 +232,14 @@ static int aax_read_header(AVFormatContext *s)
         int64_t col_offset;
         int flag, type;
 
-        if (strcmp(a->xcolumns[c].name, "data"))
+        if (!a->xcolumns[c].name || strcmp(a->xcolumns[c].name, "data"))
             continue;
 
         type = a->xcolumns[c].type;
         flag = a->xcolumns[c].flag;
         col_offset = a->xcolumns[c].offset;
 
-        for (int r = 0; r < a->nb_segments; r++) {
+        for (uint64_t r = 0; r < a->nb_segments; r++) {
             if (flag & COLUMN_FLAG_DEFAULT) {
                 data_offset = a->schema_offset + col_offset;
             } else if (flag & COLUMN_FLAG_ROW) {
@@ -264,6 +264,11 @@ static int aax_read_header(AVFormatContext *s)
         }
     }
 
+    if (!a->segments[0].end) {
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
+
     st = avformat_new_stream(s, NULL);
     if (!st) {
         ret = AVERROR(ENOMEM);
@@ -330,7 +335,7 @@ static int aax_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     pkt->pos = avio_tell(pb);
 
-    for (int seg = 0; seg < a->nb_segments; seg++) {
+    for (uint32_t seg = 0; seg < a->nb_segments; seg++) {
         int64_t start = a->segments[seg].start;
         int64_t end   = a->segments[seg].end;