kokke / kokke/tiny-regex-c

Possible bugs

Open
#97 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

```
gcc -I. -Wall -c main.c -o main.o
main.c:53:10: warning: unused variable 'p2' [-Wunused-variable]
53 | re_t p2 = re_compile("b"); /* This call corrupts p1's data */
| ^~
1 warning generated.
gcc main.o re.o -o test_bugs
./test_bugs
=== Validating Discovered Errors in tiny-regex-c ===

=== Validating Discovered Errors in tiny-regex-c ===

[BUG FOUND] Empty Match Rejected Pattern: 'a* ' Text: ' ' -> Result: -1 (Bug: Implementation gave -1, but Correct spec says 0)
[BUG FOUND] Anchor Fails Empty Pattern: '$ ' Text: ' ' -> Result: -1 (Bug: Implementation gave -1, but Correct spec says 0)
[BUG FOUND] Connected Range Leak Pattern: '[0-9-a] ' Text: '@ ' -> Result: 0 (Bug: Implementation gave 0, but Correct spec says -1)
[NO BUG ] Silent Truncation Pattern: '^abc$ ' Text: 'ab ' -> Result: -1
[BUG FOUND] Static Clobbering Pattern 'a' failed to match 'a' after compiling 'b'.
[BUG FOUND] Trailing Backslash Pattern: '\ ' Text: 'a ' -> Result: 0 (Bug: Implementation gave 0, but Correct spec says -1)
[BUG FOUND] Signedness Range Pattern: '[a-?] ' Text: 'b ' -> Result: -1 (Bug: Implementation gave -1, but Correct spec says 0)
[BUG FOUND] Ghost Anchor Pattern 'b^' matched 'bA' due to stale memory from 'aA'.

```

[main.c](https://github.com/user-attachments/files/24141984/main.c)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached main.c and reproduce the issue using the shown gcc commands and ./test_bugs. Review each reported case—empty matches, anchors, ranges, trailing backslashes, static clobbering, and signedness—and consider the work complete when the observed results match the stated expected results.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.