sips crashes with unrecognized selector when running JavaScript

Originator:rito.0305
Number:rdar://FB9107498 Date Originated:May 16, 2021 at 11:08 AM
Status:Open Resolved:
Product:macOS Product Version:
Classification: Reproducible:
 
It can be reproduced with the following commands.

```
$ cat index.js
images
$ sips -debug -j index.js
2021-05-16 09:27:22.390 sips[98265:1652726] -[__NSArrayM length]: unrecognized selector sent to instance 0x7fc180604330
2021-05-16 09:27:22.390 sips[98265:1652726] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM length]: unrecognized selector sent to instance 0x7fc180604330'
*** First throw call stack:
(
        0   CoreFoundation                      0x00007fff351d1be7 __exceptionPreprocess + 250
        1   libobjc.A.dylib                     0x00007fff6dff05bf objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff35250c77 -[NSObject(NSObject) __retain_OA] + 0
        3   CoreFoundation                      0x00007fff3513644b ___forwarding___ + 1427
        4   CoreFoundation                      0x00007fff35135e28 _CF_forwarding_prep_0 + 120
        5   sips                                0x0000000109e2ceb8 sips + 28344
        6   sips                                0x0000000109e28e8f sips + 11919
        7   sips                                0x0000000109e295dc sips + 13788
        8   libdyld.dylib                       0x00007fff6f197cc9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
```

Apparently calling the most of functions or referencing variables leads a constant crash.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!