diff --git a/src/spss/readstat_sav_read.c b/src/spss/readstat_sav_read.c index 460bf07..d36bab9 100644 --- a/src/spss/readstat_sav_read.c +++ b/src/spss/readstat_sav_read.c @@ -717,7 +717,11 @@ static readstat_error_t sav_process_row(unsigned char *buffer, size_t buffer_len } if (++offset == col_info->width) { if (++segment_offset < var_info->n_segments) { - if (raw_str_used > 0) raw_str_used--; + if (raw_str_used == 0) { + retval = READSTAT_ERROR_PARSE; + goto done; + } + raw_str_used--; } offset = 0; col++;