40 #define MAX_SWF_DECOMPRESSED_LEN 50000000
46 const uint32_t buffer_len)
52 uint32_t a = buffer[4];
53 uint32_t b = buffer[5];
54 uint32_t c = buffer[6];
55 uint32_t d = buffer[7];
57 uint32_t value = (((a & 0xff) << 24UL) |
58 ((b & 0xff) << 16UL) |
62 uint32_t
len = (((value >> 24) & 0x000000FFUL) |
63 ((value >> 8) & 0x0000FF00UL) |
64 ((value << 8) & 0x00FF0000UL) |
65 ((value << 24) & 0xFF000000UL));
84 uint8_t *compressed_data, uint32_t compressed_data_len,
85 uint8_t *decompressed_data, uint32_t decompressed_data_len)
89 memset(&infstream, 0,
sizeof(infstream));
90 infstream.zalloc = Z_NULL;
91 infstream.zfree = Z_NULL;
92 infstream.opaque = Z_NULL;
94 infstream.avail_in = (uInt)compressed_data_len;
95 infstream.next_in = (Bytef *)compressed_data;
96 infstream.avail_out = (uInt)decompressed_data_len;
97 infstream.next_out = (Bytef *)decompressed_data;
99 int result = inflateInit(&infstream);
100 if (result != Z_OK) {
105 result = inflate(&infstream, Z_NO_FLUSH);
128 inflateEnd(&infstream);
139 uint8_t *compressed_data, uint32_t compressed_data_len,
140 uint8_t *decompressed_data, uint32_t decompressed_data_len)
144 size_t inprocessed = compressed_data_len;
145 size_t outprocessed = decompressed_data_len;
147 ret = lzma_decompress(compressed_data, &inprocessed, decompressed_data, &outprocessed,
158 case LzmaHeaderTooShortError:
166 case LzmaMemoryError: