Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 3077045

Browse files
committed
[ CID 15998 ] libgraphics: image.cpp: Dereference before null check in MCGImageCreateWithSkBitmap
Fixed by moving t_bitmap->lockPixels() call to after successful null check.
1 parent c39705b commit 3077045

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libgraphics/src/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ bool MCGImageCreateWithSkBitmap(const SkBitmap &p_bitmap, MCGImageRef &r_image)
4747
if (t_success)
4848
{
4949
t_bitmap = new SkBitmap(p_bitmap);
50-
t_bitmap -> lockPixels();
5150
t_success = nil != t_bitmap;
5251
}
5352

5453
if (t_success)
5554
{
55+
t_bitmap -> lockPixels();
5656
t_image -> bitmap = t_bitmap;
5757
t_image -> is_valid = true;
5858
t_image -> references = 1;

0 commit comments

Comments
 (0)