Commit 1ecb04e
committed
I have implemented heap-copy approach for both buffering queues in the interceptor:
Inbound Queue (savedMessages): In DataPlaneListener.onMessage, when a message is queued (because we are waiting for external processor header responses), it is now synchronously copied into a heap-allocated ByteString and queued as a KnownLengthInputStream. This prevents gRPC's deframer from recycling the underlying Netty direct buffers when onMessage returns, fully resolving the inbound Use-After-Free risk.
Outbound Queue (pendingDrainingMessages): In DataPlaneClientCall.sendMessage, when outbound messages are queued (because the ext-proc stream is draining or completing), we now synchronously read the stream into a heap-allocated ByteString and queue it as a KnownLengthInputStream before returning immediately to the application. This ensures that even if the application manually reclaims off-heap direct buffers immediately after sendMessage returns, the buffered message remains perfectly safe and valid for later transmission, resolving the outbound Use-After-Free/caching risk.1 parent 6d62895 commit 1ecb04e
1 file changed
Lines changed: 12 additions & 2 deletions
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
994 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
995 | 1000 | | |
996 | 1001 | | |
997 | 1002 | | |
| |||
1301 | 1306 | | |
1302 | 1307 | | |
1303 | 1308 | | |
1304 | | - | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
1305 | 1315 | | |
1306 | 1316 | | |
1307 | 1317 | | |
| |||
0 commit comments