-
Notifications
You must be signed in to change notification settings - Fork 128
MSVC parser stack overflow #64
Comments
A table lookup seems reasonable. The file is generated by |
I see. But I'm very rusty on Perl 😢. How about me trying to use Python for this? |
I think that would be fine. |
I now have a working Python script for generating
from the base-dir. I will try to do a similar rewrite of |
Cool. We might want to update it to use the CSV format of the newer |
I haven't looked at the generated code closely yet, but I wrote a script to test it through the Geo::IP Perl API:
Unfortunately this fails with errors and eventually a segfault:
It runs fine on the old version. |
Can't say since I'm a Perl neophyte and I don't know how your script works. |
It just calls that function through the Perl API for every pair in the file. It would be easy to do the same with the Python GeoIP extension if you want to try that. |
The back trace suggests that the problem is here:
|
Hm. I've changed the script into something that was in the original .pl-script. Diff:
Updated Rev. 1B here. I'm now working on
What's special about |
It no longer segfaults for me on valid input, but not all of the country/region pairs match. From that same script:
As far as the regions go, I am not sure why those exact numbers were used to generate the region number. I assume it is produce a unique mapping. |
Looks like your script only fails on some countries with multiple regions and time-zones. Seem I've misunderstood some details in rewriting
or just a |
I now also have a working (?) Python script for generating
Was that the original intention? |
I don't think it is a case sensitivity issue. The script takes the country and region from the I did not write the region script. |
Hi all, I use Visual Studio 2015 and suffer the same problem like @gvanem . |
How can I reproduce this error? I'd like to get this automatically tested by our Windows CI. I tried to reproduce it in AppVeyor but both the x86 and x64 builds seem to work fine using |
This is based off of updated scripts from elliotlo in GitHub issue #64. This should fix a parser stack overflow issue that was reported in MSVC.
This is based off of updated scripts from elliotlo in GitHub issue #64. This should fix a parser stack overflow issue that was reported in MSVC.
I created a empty project for geoip. Build it by Visual Studio 2015 Community Version IDE, |
Segfault Fix, More Safety Checks, Windows Fixes * Fixed a MSVC parser stack overflow when parsing `regionName.c` and `timeZone.c`. Fix by elliotlo. GitHub #64. * Updated region codes and timezones. * When using `GEOIP_MEMORY_CACHE` with an invalid database file, the search tree traversal could attempt to read memory outside of the memory allocated for the memory cache, resulting in a segmentation fault. A check was added to ensure that the traversal code does not try to read beyond the end of the file, whether in memory, memory mapped, or on disk. * Previously the return values from file reads were ignored. We now check these values to ensure that there were no errors.
Trying to compile
regionName.c
consistently reports:This happens even on the latest MSVC v19.00.23026 for x86 (on Win-8.1). I've not tried X64, but the
parser stack overflow
(i.e. internal compiler error) also happens in MSVC v18.x.y. I've tried several variations ofCFLAGS
and optimize settings w/o any cure.IMHO the
regionName.c
should be written using table-lookup. But I'll let you decide if I shall make adiff
for this. Funny this has gone unnoticed for so long....The text was updated successfully, but these errors were encountered: