Skip to content

Commit

Permalink
check for margins < raw size; limit memmove in raw2image
Browse files Browse the repository at this point in the history
  • Loading branch information
alextutubalin committed Aug 20, 2020
1 parent 4feaed4 commit d78c328
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/metadata/identify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,8 @@ void LibRaw::identify()
pixel_aspect < 0.1 || pixel_aspect > 10. ||
raw_height > 64000)
is_raw = 0;

if(raw_width <= left_margin || raw_height <= top_margin)
is_raw = 0;
#ifdef NO_JASPER
if (load_raw == &LibRaw::redcine_load_raw)
{
Expand Down
4 changes: 2 additions & 2 deletions src/preprocessing/raw2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ int LibRaw::raw2image_ex(int do_subtract_black)
{
// legacy is always 4channel and not shrinked!
memmove(imgdata.image, imgdata.rawdata.color4_image,
MIN(S.raw_width - S.left_margin, S.width) *
MIN(S.raw_height - S.top_margin, S.height) *
MAX(0,MIN(S.raw_width - S.left_margin, S.width)) *
MAX(0,MIN(S.raw_height - S.top_margin, S.height)) *
sizeof(*imgdata.image));
}
}
Expand Down

0 comments on commit d78c328

Please sign in to comment.