Commit 97d8d11
bug: ensure FFI glue always passes a valid pointer
Previously, if a caller provided a `&Vec::new()` to the
search function, then the library would pass that vec's
pointer to PCRE2 directly. Since creating an empty Vec
does not allocate, this pointer is actually invalid and
cannot be dereferenced. However, PCRE2 (rightfully)
assumes the pointer it is handed is valid.
We fix this by detecting the case of an empty slice.
If it's empty, we pass a pointer to an empty slice that
we know is valid.1 parent a62c798 commit 97d8d11
2 files changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1259 | 1259 | | |
1260 | 1260 | | |
1261 | 1261 | | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1262 | 1275 | | |
1263 | 1276 | | |
1264 | 1277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
409 | 419 | | |
410 | 420 | | |
411 | 421 | | |
| |||
0 commit comments