| 1 | ; build with:
|
|---|
| 2 | ; csc test.scm
|
|---|
| 3 |
|
|---|
| 4 | (use irregex)
|
|---|
| 5 |
|
|---|
| 6 | (define-external
|
|---|
| 7 | (my_callback (c-pointer data)) void
|
|---|
| 8 | ; on my machine, it dies at the 2nd attempt
|
|---|
| 9 | (print "let's try and crash")
|
|---|
| 10 | (work)
|
|---|
| 11 | (print "done"))
|
|---|
| 12 |
|
|---|
| 13 | ; just to keep the thing busy, this is what triggers the crash
|
|---|
| 14 | (define (work)
|
|---|
| 15 | (do ([i 0 (+ i 1)]) ((< 150000 i) #t)
|
|---|
| 16 | (irregex-search "( |_|-|#|\\.)[0 ]*14[^0-9]" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")))
|
|---|
| 17 |
|
|---|
| 18 | (foreign-declare
|
|---|
| 19 | "
|
|---|
| 20 | void call_thing (void (*callback) (void* data)) {
|
|---|
| 21 | callback(NULL);
|
|---|
| 22 | }
|
|---|
| 23 | "
|
|---|
| 24 | )
|
|---|
| 25 |
|
|---|
| 26 | (define foo (foreign-safe-lambda void "call_thing" c-pointer))
|
|---|
| 27 |
|
|---|
| 28 | (foo #$my_callback)
|
|---|
| 29 | (foo #$my_callback)
|
|---|
| 30 | (foo #$my_callback)
|
|---|
| 31 | (foo #$my_callback)
|
|---|