1 diff --git a/gfx/ots/src/glat.cc b/gfx/ots/src/glat.cc
2 --- a/gfx/ots/src/glat.cc
3 +++ b/gfx/ots/src/glat.cc
10 +#include "mozilla/Compression.h"
15 @@ -214,16 +214,17 @@ bool OpenTypeGLAT_v3::Parse(const uint8_
16 OTS_MAX_DECOMPRESSED_TABLE_SIZE / (1024.0 * 1024.0),
17 decompressed_size / (1024.0 * 1024.0));
19 std::unique_ptr<uint8_t> decompressed(new uint8_t[decompressed_size]());
20 - int ret = LZ4_decompress_safe_partial(
21 + size_t outputSize = 0;
22 + bool ret = mozilla::Compression::LZ4::decompressPartial(
23 reinterpret_cast<const char*>(data + table.offset()),
24 - reinterpret_cast<char*>(decompressed.get()),
25 table.remaining(), // input buffer size (input size + padding)
26 + reinterpret_cast<char*>(decompressed.get()),
27 decompressed_size, // target output size
28 - decompressed_size); // output buffer size
29 - if (ret < 0 || unsigned(ret) != decompressed_size) {
30 - return DropGraphite("Decompression failed with error code %d", ret);
31 + &outputSize); // return output size
32 + if (!ret || outputSize != decompressed_size) {
33 + return DropGraphite("Decompression failed");
35 return this->Parse(decompressed.get(), decompressed_size, true);
38 diff --git a/gfx/ots/src/silf.cc b/gfx/ots/src/silf.cc
39 --- a/gfx/ots/src/silf.cc
40 +++ b/gfx/ots/src/silf.cc
47 +#include "mozilla/Compression.h"
52 @@ -49,16 +49,17 @@ bool OpenTypeSILF::Parse(const uint8_t*
53 OTS_MAX_DECOMPRESSED_TABLE_SIZE / (1024.0 * 1024.0),
54 decompressed_size / (1024.0 * 1024.0));
56 std::unique_ptr<uint8_t> decompressed(new uint8_t[decompressed_size]());
57 - int ret = LZ4_decompress_safe_partial(
58 + size_t outputSize = 0;
59 + bool ret = mozilla::Compression::LZ4::decompressPartial(
60 reinterpret_cast<const char*>(data + table.offset()),
61 - reinterpret_cast<char*>(decompressed.get()),
62 table.remaining(), // input buffer size (input size + padding)
63 + reinterpret_cast<char*>(decompressed.get()),
64 decompressed_size, // target output size
65 - decompressed_size); // output buffer size
66 - if (ret < 0 || unsigned(ret) != decompressed_size) {
67 - return DropGraphite("Decompression failed with error code %d", ret);
68 + &outputSize); // return output size
69 + if (!ret || outputSize != decompressed_size) {
70 + return DropGraphite("Decompression failed");
72 return this->Parse(decompressed.get(), decompressed_size, true);