Repository navigation
Commit 64edccd
authored
Delete local references to Java-returned result arrays in JNI callbacks (#1016)
Motivation:
resultArray in cert_compress.c compress()/decompress() and resultBytes
in the SSL_PRIVATE_KEY_METHOD callbacks in sslcontext.c are obtained
from CallObjectMethod/GetObjectField but were never deleted on any
exit path. These are invoked repeatedly as native callbacks from
OpenSSL/BoringSSL (once per certificate needing (de)compression, or
per sign/decrypt/complete call), so the leaked local references
accumulate and can exhaust the JNI local reference table.
Modifications:
- cert_compress.c: delete resultArray before every return in compress()
and decompress() once it has been obtained.
- sslcontext.c: delete resultBytes at the complete: label in
tcn_private_key_sign_java and tcn_private_key_decrypt_java, and
before every return in tcn_private_key_complete_java.
Result:
No longer leak local references to compression/private-key callback
result arrays.1 parent bdbc9d9 commit 64edccd
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| 108 | + | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2281 | 2281 | | |
2282 | 2282 | | |
2283 | 2283 | | |
| 2284 | + | |
2284 | 2285 | | |
2285 | 2286 | | |
2286 | 2287 | | |
| |||
2350 | 2351 | | |
2351 | 2352 | | |
2352 | 2353 | | |
| 2354 | + | |
2353 | 2355 | | |
2354 | 2356 | | |
2355 | 2357 | | |
| |||
2388 | 2390 | | |
2389 | 2391 | | |
2390 | 2392 | | |
| 2393 | + | |
2391 | 2394 | | |
2392 | 2395 | | |
2393 | 2396 | | |
2394 | 2397 | | |
2395 | 2398 | | |
2396 | 2399 | | |
2397 | 2400 | | |
| 2401 | + | |
2398 | 2402 | | |
2399 | 2403 | | |
2400 | 2404 | | |
| 2405 | + | |
2401 | 2406 | | |
2402 | 2407 | | |
2403 | 2408 | | |
2404 | 2409 | | |
2405 | 2410 | | |
| 2411 | + | |
2406 | 2412 | | |
2407 | 2413 | | |
2408 | 2414 | | |
| |||
0 commit comments