bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EGexecute: don't assume buffer ends in a newline


From: Paolo Bonzini
Subject: Re: EGexecute: don't assume buffer ends in a newline
Date: Mon, 24 May 2010 13:06:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.4

On 05/24/2010 12:54 PM, Bruno Haible wrote:
Hi Paolo,

         /* If we've made it to this point, this means DFA has seen
            a probable match, and we need to run it through Regex. */
-      best_match = end;
+      best_match = end + 1;

Shouldn't this be

    best_match = end + (end<  buflim);

?

No. You see that and the end of the search loop, there is a
     if (best_match<  end)
that I turned into
     if (best_match<= end)
This statement is meant to detect whether a match has been found at all.
So, the initial value of best_match has to be greater than 'end' in all cases.

Right. That's violating ISO C's rule for validity of pointers though. In practice I don't think it matters, but I'd rather get a second opinion on this patch.

Otherwise, the patch seems okay.  Are you going to patch Fexecute too?

You fixed Fexecute already. With msggrep and its use of buffers that don't
end in a newline, I did not detect a bug in Fexecute. Only in EGexecute.

Ah, okay, I didn't understand that.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]