Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66ce1c3b authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Leon Scroggins
Browse files

Lock SkBitmap before accessing color table

This only affects kIndex_8 Bitmaps, which can only be created by
decoding particular images (e.g. GIF). Without locking the SkBitmap,
colorTable() always returns NULL. Lock it so we can write the color
table to the Parcel.

BUG:26527976
Change-Id: Ifc54b06ca08db26ba6455a3830b7e671b64f37c4
parent fe54b118
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1087,6 +1087,8 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
    p->writeInt32(density);

    if (bitmap.colorType() == kIndex_8_SkColorType) {
        // The bitmap needs to be locked to access its color table.
        SkAutoLockPixels alp(bitmap);
        SkColorTable* ctable = bitmap.getColorTable();
        if (ctable != NULL) {
            int count = ctable->count();