Fixes #551
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
pos->offset = 0;
} else {
read_next_packet:
pos->offset = 0;
} else {
read_next_packet:
- if (pos->cur_index >= pos->packet_cycles_index->len) {
- pos->offset = EOF;
- return;
- }
- if (pos->cur_index >= pos->packet_real_index->len) {
- pos->offset = EOF;
- return;
- }
switch (whence) {
case SEEK_CUR:
{
switch (whence) {
case SEEK_CUR:
{
if (pos->offset == EOF) {
return;
}
if (pos->offset == EOF) {
return;
}
+ assert(pos->cur_index < pos->packet_cycles_index->len);
+ assert(pos->cur_index < pos->packet_real_index->len);
+
/* For printing discarded event count */
packet_index = &g_array_index(pos->packet_cycles_index,
struct packet_index, pos->cur_index);
/* For printing discarded event count */
packet_index = &g_array_index(pos->packet_cycles_index,
struct packet_index, pos->cur_index);
+ if (index >= pos->packet_cycles_index->len) {
+ pos->offset = EOF;
+ return;
+ }
packet_index = &g_array_index(pos->packet_cycles_index,
struct packet_index, index);
pos->last_events_discarded = packet_index->events_discarded;
packet_index = &g_array_index(pos->packet_cycles_index,
struct packet_index, index);
pos->last_events_discarded = packet_index->events_discarded;