krishprober's picture
onnx-tensorrt external_data offset OOB read PoC (CWE-125)
4616d53
Raw
History Blame Contribute Delete
785 Bytes
#!/bin/bash
# GPU-free ASAN PoC for onnx-tensorrt external_data `offset` OOB read (CWE-125).
# Deps obtained without sudo: TensorRT headers (NVIDIA/TensorRT), protobuf via `apt-get download`+`dpkg-deb -x`.
set -e
OTSRC=../src/onnx-tensorrt; TRTINC=../src/TensorRT/include
localroot/usr/bin/protoc --proto_path=. --cpp_out=. onnx/onnx-ml.proto
clang++ -fsanitize=address -g -O0 -std=c++17 -DONNX_NAMESPACE=onnx \
-I stubs -I "$OTSRC" -I "$TRTINC" -I localroot/usr/include -I . \
harness.cpp stubs.cpp onnx/onnx-ml.pb.cc \
"$OTSRC/WeightsContext.cpp" "$OTSRC/WeightsContextMemoryMap.cpp" "$OTSRC/ShapedWeights.cpp" \
"$OTSRC/weightUtils.cpp" "$OTSRC/bfloat16.cpp" "$OTSRC/errorHelpers.cpp" \
localroot/usr/lib/x86_64-linux-gnu/libprotobuf-lite.a -lpthread -o poc_oob
./poc_oob