Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking allocation failures #627

Open
zherczeg opened this issue Dec 15, 2024 · 1 comment
Open

Checking allocation failures #627

zherczeg opened this issue Dec 15, 2024 · 1 comment
Labels
untidiness Not exactly a bug, but could do better
Milestone

Comments

@zherczeg
Copy link
Collaborator

zherczeg commented Dec 15, 2024

Since a lot of effort spent on code stability somebody might want to work on allocation failure checking. This kind of testing rely on the custom allocators provided by PCRE2.

These should be the steps:

  1. Pick a pattern, could be a random pattern

  2. Compile / JIT compile the pattern
    All allocations are successful, the number of allocations are counted. Their number is N

  3. Loop:

for (I = 0; i < N; I++)
  Compile / JIT compile the pattern
  Only the first I allocations are successful, then the allocator returns with NULL

The engine should not crash. Furthermore, the custom free function should be called I times, and not with NULL argument. Memory checkers should be able to detect if some memory blocks are not freed.

This could be built into pcre2test.

@NWilson
Copy link
Member

NWilson commented Dec 16, 2024

Yes, nice plan! We'd get a good coverage improvement too, since all those allocation failures are totally untested, at the moment.

I might get time to do it this week, or if not, then in January.

@NWilson NWilson changed the title Cheking allocation failures Checking allocation failures Dec 17, 2024
@NWilson NWilson added this to the 10.45 milestone Dec 18, 2024
@NWilson NWilson modified the milestones: 10.45, 10.46 Jan 8, 2025
@NWilson NWilson added the untidiness Not exactly a bug, but could do better label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untidiness Not exactly a bug, but could do better
Projects
None yet
Development

No branches or pull requests

2 participants