line_offset of 2^32 bytes should be enough.
This requires the removal of the last_line field (in a previous patch) to
shrink struct expr to 112 bytes.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
const struct input_descriptor *indesc;
union {
struct {
- off_t line_offset;
-
+ unsigned int line_offset;
unsigned int first_line;
unsigned int first_column;
unsigned int last_column;
static void update_offset(struct parser_state *state, struct location *loc,
unsigned int len)
{
+ uint32_t line_offset;
+
state->indesc->token_offset += len;
- loc->line_offset = state->indesc->line_offset;
+ if (state->indesc->line_offset > UINT32_MAX)
+ line_offset = UINT32_MAX;
+ else
+ line_offset = state->indesc->line_offset;
+
+ loc->line_offset = line_offset;
}
static void reset_pos(struct parser_state *state, struct location *loc)