You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
When initializing an NSExpression, passing four or more arguments to a custom vararg function causes a crash due to an uncaught exception in NSExpression’s implementation. This crash reproduces when using mgl_match: (#11464), mgl_case: (#11278), or any of the aftermarket control flow functions being added in #11472. For example:
-[MGLExpressionTests testGenericExpressionObject] : failed: caught "NSInvalidArgumentException", "-[NSInvocation setArgument:atIndex:]: index (3) out of bounds [-1, 2]"
Apparently NSExpression assumes a fixed size for varargs when building an NSInvocation. This Stack Overflow post suggests that we should pair any vararg method with a va_list method. Perhaps NSExpression somehow knows to look for that method when building the invocation; not sure.
This is a mostly academic point. The conversion to JSON objects in +[NSExpression mgl_expressionWithJSONObject:] works just fine, and underlying Objective-C implementations of these vararg methods all raise a “not implemented” exception anyways. But it would be a better user experience to see that exception than the one about out-of-bounds access.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
When initializing an NSExpression, passing four or more arguments to a custom vararg function causes a crash due to an uncaught exception in NSExpression’s implementation. This crash reproduces when using
mgl_match:
(#11464),mgl_case:
(#11278), or any of the aftermarket control flow functions being added in #11472. For example:-[MGLExpressionTests testGenericExpressionObject] : failed: caught "NSInvalidArgumentException", "-[NSInvocation setArgument:atIndex:]: index (3) out of bounds [-1, 2]"
Apparently NSExpression assumes a fixed size for varargs when building an NSInvocation. This Stack Overflow post suggests that we should pair any vararg method with a
va_list
method. Perhaps NSExpression somehow knows to look for that method when building the invocation; not sure.This is a mostly academic point. The conversion to JSON objects in
+[NSExpression mgl_expressionWithJSONObject:]
works just fine, and underlying Objective-C implementations of these vararg methods all raise a “not implemented” exception anyways. But it would be a better user experience to see that exception than the one about out-of-bounds access./cc @fabian-guerra @anandthakker
The text was updated successfully, but these errors were encountered: