Skip to contentSkip to conversation

scanner: fix reading of really long line

PATCH Eric Leblond 2 participants 2 messages Dec 1, 2014 – Dec 3, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

Quoted 6 lines · Pablo Neira Ayuso
Quoted 4 lines · Eric Leblond

Current code is causing a failure in adding a set containing a really long list of elements. The failure occurs as soon as the line is longer than flex read buffer.

Quoted 8 lines
Quoted 5 lines

When a line is longer than scanner buffer size, the code in YY_INPUT forces a rewind to the beginning of the string because it does not find a end of line. The result is that the string is never parsed.

This patch updates the code by rewinding till we found a space.

But the part that didn't fit in will be ignore, right? So the user will lose some elements in the set?

This is not the case as there is a fseek below to rewind at the correct position. So next read get the data from the correct point.

BR,

Quoted 2 lines

If so, I think it's better to spot an error via YY_FATAL_ERROR to indicate that the line is too long to the user.

#1 lore raw
Quoted 12 lines · Eric Leblond

Hello,

Quoted 10 lines · Pablo Neira Ayuso
Quoted 8 lines · Eric Leblond

Current code is causing a failure in adding a set containing a really long list of elements. The failure occurs as soon as the line is longer than flex read buffer.

When a line is longer than scanner buffer size, the code in YY_INPUT forces a rewind to the beginning of the string because it does not find a end of line. The result is that the string is never parsed.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

This patch updates the code by rewinding till we found a space.

But the part that didn't fit in will be ignore, right? So the user will lose some elements in the set?

This is not the case as there is a fseek below to rewind at the correct position. So next read get the data from the correct point.

OK. Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html