coreml-rootmodelidentifier-crash-poc / CoreMLPyObjCCompileOne.py
cmpndry's picture
Add Core ML rootModelIdentifier crash PoC (seed + manifests + rebuild script)
87234eb verified
Raw
History Blame Contribute Delete
433 Bytes
import sys
from Foundation import NSURL
import CoreML
if len(sys.argv) != 2:
print("usage: CoreMLPyObjCCompileOne.py <path-to-mlpackage-or-mlmodel>")
sys.exit(2)
url = NSURL.fileURLWithPath_(sys.argv[1])
try:
result = CoreML.MLModel.compileModelAtURL_error_(url, None)
print("COMPILE_RETURN", repr(result)[:800])
except BaseException as exc:
print("CONTROLLED_EXCEPTION", type(exc).__name__, str(exc)[:800])