Fix: check packet index len
[babeltrace.git] / formats / ctf / ctf.c
index 317457e883c5d7dab6271d3b5c430281e96ca987..278956b85e32a253af7491c8528b85712e643119 100644 (file)
@@ -1716,6 +1716,11 @@ int import_stream_packet_index(struct ctf_trace *td,
                ret = -1;
                goto error;
        }
+       if (index_hdr.packet_index_len == 0) {
+               fprintf(stderr, "[error] Packet index length cannot be 0.\n");
+               ret = -1;
+               goto error;
+       }
 
        while ((index_read = fread(&ctf_index, index_hdr.packet_index_len, 1,
                                        pos->index_fp)) == 1) {
This page took 0.023354 seconds and 4 git commands to generate.