[Issue 11350] libphobos2 regex match segfaults when a rare HTTP header is received
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 25 11:21:28 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11350
Dmitry Olshansky <dmitry.olsh at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmitry.olsh at gmail.com
--- Comment #1 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-10-25 11:21:26 PDT ---
(In reply to comment #0)
>
> It seems the bug is at:
>
> /usr/include/dmd/phobos/std/regex.d line 6348
>
> 6537 public auto match(R, RegEx)(R input, RegEx re)
> 6538 if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R)))
> 6539 {
> 6540 return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(re, input);
> 6541 }
>
> Maybe is an encoding problem, it seems the input is:
> >>> print "%c%c%c%c%c%c%c%c%c" % (0x64,0x61,0x97,0x48,0x34,0x53,0x54,0x65,0x46)
> da�H4STeF
>
Would be nice to see what pattern that is and how exactly the argument to it
looks like.
I tried to reproduce with this:
void main()
{
import std.regex;
ubyte[] header = [0x64,0x61,0x97,0x48,0x34,0x53,0x54,0x65,0x46];
auto m = match(cast(char[]) header, regex("(.*?): (.*)$"));
assert(m.empty);
}
I get:
std.utf.UTFException at C:\dmd2\windows\bin\..\..\src\phobos\std\utf.d(1113):
Invalid UTF-8 sequence (at index 1)
No crashes.
Now it may have to do with shared object / PIC code for all I know, as I'm
testing on Win32.
But w/o a smaller or at least complete reproduceble test-case there is nothing
to work on.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list