ImageManip colormap heap overflow, EncodedFrame::getFrameType abort, and SuperBlob bspatch bounds
Our code review of luxonis/depthai-core at 95e9d041d1139a60ec3c4bf07613759b81ef1d80 (current main HEAD; later than tag v3.12.2) found three issues. This was a source review only, nothing was run or compiled.
We did not find a private security channel (private vulnerability reporting is disabled, and the repository has no SECURITY.md or documented security contact), so we are reporting these publicly.
-
ImageManip colormap heap overflow on landscape frames. In include/depthai/utility/ImageManipImpl.hpp:884-885 the OpenCV Mats passed to applyColorMap are constructed as cv::Mat(base.outputWidth, base.outputHeight, …). OpenCV takes (rows, cols), so a landscape frame is treated as having W rows. The destination buffer is sized for RGB888i as 3·W·H (src/utility/ImageManipImpl.cpp:346; src/pipeline/node/ImageManip.cpp:46-51). This path is reachable through the public ImageManip colormap API (build() at ImageManipImpl.hpp:744-745 and :830-831 enables colormap and keeps the input size).
-
A malformed H.264/H.265 payload can make EncodedFrame::getFrameType() call exit() or crash. This is a local/trusted input path only; we did not find a remote access path. src/pipeline/datatype/EncodedFrame.cpp:73 and :76 index [0] of getTypesH264 / getTypesH265. A truncated or malformed AVC or HEVC payload can make utility::readGE() in src/utility/H26xParsers.cpp:145 call exit(30), or leave that vector empty so the [0] access is invalid. src/pipeline/datatype/StreamMessageParser.cpp:212-213 deserializes EncodedFrame on this path. JPEG is not affected.
-
A malformed .superblob can lead to an out-of-bounds read or a large memcpy in bspatch_mem. OpenVINO::SuperBlob::validateSuperblob() (src/openvino/OpenVINO.cpp:192-208) does not reject negative blobSize or patchSizes and sums those sizes with std::accumulate(..., 0) (int). getBlobWithNumShaves() at :123-127 does not check the return values of bspatch_mem_get_newsize or bspatch_mem. In src/bspatch/bspatch.c, bzctrllen / bzdatalen are not required to fit in the patch, control memcpy lengths can be negative (offtin is signed), and realloc may be called with size 0.
A fix is available on request.
Credit: Ugur Celik (ucsurf), @ucsurf — Ugur Celik (ucsurf) · https://uc.surf We find and report security issues in open source before attackers do. If our work helped you, a small contribution keeps it going and makes the internet a little safer for everyone: https://buymeacoffee.com/ucsurf