[pcre-dev] [Bug 1100] Crash backtracking over unicode sequen…

Kezdőlap
Üzenet törlése
Szerző: Tom Hughes
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] [Bug 1100] Crash backtracking over unicode sequence
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1100




--- Comment #1 from Tom Hughes <tom@???> 2011-03-25 14:42:02 ---
Created an attachment (id=471)
--> (http://bugs.exim.org/attachment.cgi?id=471)
Patch to fix backtracking

The problem is that when processing OP_EXTUNI in match() the backtracking does
this to see if we have backtracked far enough:

  if (eptr-- == pp) break;        /* Stop if tried at original pos */


The problem of course, is that simply decrementing by one will not move us
backwards properly if the last character was a multibyte UTF-8 sequence - we
need to call BACKCHAR to find the start of the previous character.

The attached patch seems to fix things, although you may have a cleaner way of
doing it.

I would also note that, from a quick search through the source, there are
probably similar problems in some of the other ops.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email