You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The overlay offsets specified in the iloc box are trusted by the program. While there are "sanity" checks in HeifPixelImage::overlay(), these checks can be bypassed with extremely large or extremely small offsets.
For instance, in poc_oob_write.heic, the x offset (dx) is INT_MAX - 10. The OOB write arises from an integer overflow in this check:
// overlay image extends past the right border -> cut width for copyif (dx+in_w>out_w) {
in_w=out_w-dx;
}
In poc_oob_read.heic, dx is INT_MIN. The OOB read arises from the UB in this check:
// overlay image started outside of left border// -> move start into the image and start at left output columnif (dx<0) {
in_x0=-dx;
out_x0=0;
}
Mitigation
A simple fix would be to check that in_y0/x0 and out_x0/y0 are within the bounds of the respective images' dimensions before using the values at the end of the function.
The text was updated successfully, but these errors were encountered:
Overview
Due to insufficient validation of image overlay offset values, it is possible to OOB read & write in
HeifPixelImage::overlay()
.Reproduction
This vulnerability exists on both master (7c9729e) and develop-v1.18.0 (44a9705).
Download from google drive:
poc_oob_read.heic
poc_oob_write.heic
Asan logs
OOB read:
OOB write:
Environment
Root cause
The overlay offsets specified in the iloc box are trusted by the program. While there are "sanity" checks in
HeifPixelImage::overlay()
, these checks can be bypassed with extremely large or extremely small offsets.For instance, in
poc_oob_write.heic
, the x offset (dx
) isINT_MAX - 10
. The OOB write arises from an integer overflow in this check:In
poc_oob_read.heic
,dx
isINT_MIN
. The OOB read arises from the UB in this check:Mitigation
A simple fix would be to check that
in_y0/x0
andout_x0/y0
are within the bounds of the respective images' dimensions before using the values at the end of the function.The text was updated successfully, but these errors were encountered: