intel / intel/hyperscan

Hyperscan throws an exception when compiling and scanning specific regex on 32-bit Windows

Open
#271 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.5k
Forks
816
Avg merge
4d 21h
Merged PRs (30d)
2

Description

Hello,
I have a problem with running Hyperscan on a program that is built for a 32-bit Windows system. (This problem is similar to #249.) When compiling some specific regular expressions, Hyperscan crashes and throws some a "read access violation exception " in the fdr.c file, the `FDR_MAIN_LOOP(z, state,get_conf_stride_2);` line. I think that there is a problem with Hyperscan.

Steps to reproduce (I am using Windows 10 - 64bit and building a 32-bit application):

1. Build and install Hyperscan using vcpkg. (Version 5.2.1 is installed right now.)
2. Compile and run the following code with Clang compiler in x86-Release mode, using Visual Studio.
```c++
#include
#include
const match_event_handler handler =
[](unsigned int id, unsigned long long /*from*/, unsigned long long /*to*/, unsigned int /*flags*/, void* /*context*/)
-> int
{
std::cout << "Matched " << id << std::endl;

return 0;
};

int main()
{
hs_database_t* db = nullptr;
hs_scratch_t* scratch = nullptr;
hs_compile_error_t* error;
char s[4] = "abc";
if (hs_compile("a[[:alpha:]]c", HS_FLAG_DOTALL | HS_FLAG_ALLOWEMPTY | HS_FLAG_MULTILINE | HS_FLAG_UTF8,
HS_MODE_BLOCK, nullptr, &db, &error) != HS_SUCCESS)
std::cout << "Error in compilation" << std::endl;

if (hs_alloc_scratch(db, &scratch) != HS_SUCCESS)
std::cout << "Error in allocating scratch" << std::endl;

hs_scan(db, s, 3, 0, scratch, handler, nullptr);

return 0;
}
```
This code correctly runs in the x64 mode, but an exception is thrown in the x86 mode.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.