OpenCV 3.0.0 through 4.14.0 and 5.0.0 through 5.1.0 contains an out-of-bounds read vulnerability in the built-in MJPEG encoder when writing grayscale frames due to incorrect level shifting in convertToYUV(). Attackers controlling pixel content written as grayscale MJPEG video can trigger unchecked cat_table and huff_dc_tab lookups, leaking adjacent or uninitialized memory into the output file or crashing the process.
https://github.com/opencv/opencv/pull/31094
https://github.com/opencv/opencv/pull/29859
https://github.com/opencv/opencv/commit/a85f8a0de94a0fbdb7d7fef51cb5132299cf35d1
https://github.com/opencv/opencv/blob/4.14.0/modules/videoio/src/cap_mjpeg_encoder.cpp#L1308
https://github.com/opencv/opencv/blob/4.14.0/modules/videoio/src/cap_mjpeg_encoder.cpp#L1140
Published: 2026-11-25
Updated: 2026-11-25
Base Score: 7.5
Vector: CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P
Severity: High
Base Score: 5.3
Vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:H
Severity: Medium
Base Score: 5.8
Vector: CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N
Severity: Medium
EPSS: 0.00214