lottie/slot: fix image deep copy logic

When the datas are copied with deep copy, memory issue caused (SEGV on unknown address) due to these reasons:

1. `mimeType` is nullptr when it's not embedded(base64) data

2. datas(b64Data, mimeType) should not be clear, it's used for next slot copy in same pair.
This commit is contained in:
Jinny You 2025-03-17 10:22:33 +09:00 committed by Hermet Park
parent ca3c0949b0
commit 02a28bf9c3

View file

@ -946,18 +946,19 @@ struct LottieBitmap : LottieProperty
if (shallow) {
b64Data = rhs.b64Data;
mimeType = rhs.mimeType;
rhs.b64Data = nullptr;
rhs.mimeType = nullptr;
} else {
//TODO: optimize here by avoiding data copy
TVGLOG("LOTTIE", "Shallow copy of the image data!");
b64Data = duplicate(rhs.b64Data);
mimeType = duplicate(rhs.mimeType);
if (rhs.mimeType) mimeType = duplicate(rhs.mimeType);
}
size = rhs.size;
width = rhs.width;
height = rhs.height;
rhs.b64Data = nullptr;
rhs.mimeType = nullptr;
}
};