Commit b3877e1
fix: in bindings/ruby/test/jfk_reader/jfk_reader in jfk_reader.c (#3756)
* fix: V-002 security vulnerability
Automated security fix generated by Orbis Security AI
* fix(ruby): use Ruby allocator macros in jfk_reader and fix memory leak
- Replace calloc/free with ALLOC_N/xfree to match Ruby binding conventions
(ALLOC_N handles overflow checking and raises NoMemoryError on failure)
- Free temporary samples buffer after conversion loop (was leaked)
- Add NULL check for fopen return value with rb_raise
- Add comment clarifying n_samples is a compile-time constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(ruby): return false instead of rb_raise in memory_view callback
rb_memory_view_get_func_t callbacks should communicate errors via
return value (false), not exceptions. rb_memory_view_get has no
exception-handling wrapper around get_func calls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* replacing ALLOC_N with rb_protect as ALLOC_N raises Ruby exceptions
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0ccd896 commit b3877e1
1 file changed
Lines changed: 50 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
5 | 23 | | |
6 | 24 | | |
7 | 25 | | |
| |||
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
16 | | - | |
| 34 | + | |
17 | 35 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
21 | 59 | | |
22 | 60 | | |
23 | | - | |
| 61 | + | |
24 | 62 | | |
25 | 63 | | |
26 | | - | |
| 64 | + | |
27 | 65 | | |
| 66 | + | |
28 | 67 | | |
29 | 68 | | |
30 | | - | |
| 69 | + | |
31 | 70 | | |
32 | 71 | | |
33 | 72 | | |
| |||
45 | 84 | | |
46 | 85 | | |
47 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
48 | 91 | | |
49 | 92 | | |
50 | 93 | | |
| |||
0 commit comments