Bug #11042
NativeInvoker may generate memptr with unknown size
100%
Related issues
History
#1 Updated by Alexandru Lungu 7 months ago
- Related to Feature #9448: compatibility test security features added
#2 Updated by Alexandru Lungu 7 months ago
- Status changed from New to WIP
- % Done changed from 0 to 80
- Assignee set to Alexandru Lungu
This is a regression of #9448, where BinaryData.getMethodSetup now returns false if the size is 0. This is incorrect for memptr generated by native access, as FWD can't tell the buffer sizes of pointers generated by arbitrary libraries. Currently, the native invoker is completely broken for API that return pointers, as NativeBuffer.restore does something like:
memptr local = new memptr(); local.setPointerValue(addr); val = local.getInt64(1);
The getInt checks for getMethodSetup which fails due to size being 0. So, the getter returns ?.
I have a fix I will post immediately.
#4 Updated by Alexandru Lungu 7 months ago
- % Done changed from 80 to 100
- Status changed from WIP to Review
- reviewer Constantin Asofiei, Teodor Gorghe added
I committed 11042a/rev. 16324.
- I forced the size of the memptr to be 4 or 8 to represent the pointer gathered through native interface.
- The goal of the code altered is to retrieve the data at the provided
memptr, which is expected to be a pointer (asNativeBufferis the governing class, not @NativePrimitive). - That native pointer will be eventually assigned to the
memptr. This is sent back to the server and the input-output parameter is assigned properly. At that point, we can't find out the length of the native pointer, as it will most probably refer a C struct that is arbitrarily large. That pointer is usually sent back to other native API.
This unblocks the testing of #10981 completely.
#7 Updated by Alexandru Lungu 6 months ago
- Status changed from Internal Test to Merge Pending
Tested 11042a with two unit test suites (one from #9448 that caused the regression). There were no issues found. The POC that required this fix is properly working.
Preparing to merge 11042a to trunk.
#8 Updated by Alexandru Lungu 6 months ago
- Status changed from Merge Pending to Test
Branch 11042a was merged into trunk as rev. 16340 and archived.