input/vcd: abort VCD import when timestamp counts backwards
The VCD specification requests that timestamps will strictly increase as one advances through the file. Add another check where the previous implementation resulted in a tight loop and made the application stall. Do print an error message and abort file processing in that case. This fixes bug #1250.
This commit is contained in:
parent
e6104296c2
commit
ed367d6820
|
@ -408,6 +408,10 @@ static void parse_contents(const struct sr_input *in, char *data)
|
|||
inc->prev_timestamp = inc->skip;
|
||||
} else if (timestamp == inc->prev_timestamp) {
|
||||
/* Ignore repeated timestamps (e.g. sigrok outputs these) */
|
||||
} else if (timestamp < inc->prev_timestamp) {
|
||||
sr_err("Invalid timestamp: %" PRIu64 " (smaller than previous timestamp).", timestamp);
|
||||
inc->skip_until_end = TRUE;
|
||||
break;
|
||||
} else {
|
||||
if (inc->compress != 0 && timestamp - inc->prev_timestamp > inc->compress) {
|
||||
/* Compress long idle periods */
|
||||
|
|
Loading…
Reference in New Issue