Skip to content

Commit 4f9c212

Browse files
committed
fix gif decoder when variable is not inited
1 parent cff331e commit 4f9c212

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gif/src/main/cpp/GifDecoder.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Java_com_github_penfeizhou_animation_gif_decode_GifFrame_uncompressLZW(
5656
std::vector<Slice> table_string;
5757

5858
Slice prefix;
59+
prefix.len_data = 0;
60+
prefix.ptr_data = nullptr;
5961
int table_max_size = (1 << 12) - code_end - 1;
6062
while (idx_pixel < pixelsSize) {
6163
if (offset_data == 0) {
@@ -110,8 +112,9 @@ Java_com_github_penfeizhou_animation_gif_decode_GifFrame_uncompressLZW(
110112
// update ptr so that new table item contain sufix
111113
slice.ptr_data = pixelsBuffer + idx_pixel - prefix.len_data;
112114
slice.len_data = prefix.len_data + 1;
113-
memcpy(pixelsBuffer + idx_pixel, current.ptr_data, current.len_data *
114-
sizeof(int));
115+
memcpy(pixelsBuffer + idx_pixel, current.ptr_data,
116+
current.len_data *
117+
sizeof(int));
115118
idx_pixel += current.len_data;
116119

117120
prefix.ptr_data = current.ptr_data;

0 commit comments

Comments
 (0)