2017-08-12 02:36:12 +03:00
|
|
|
diff --git a/gfx/ots/src/glat.cc b/gfx/ots/src/glat.cc
|
|
|
|
--- a/gfx/ots/src/glat.cc
|
|
|
|
+++ b/gfx/ots/src/glat.cc
|
2018-07-24 23:09:00 +03:00
|
|
|
@@ -4,9 +4,9 @@
|
|
|
|
|
2017-08-12 02:36:12 +03:00
|
|
|
#include "glat.h"
|
|
|
|
|
|
|
|
#include "gloc.h"
|
|
|
|
-#include "lz4.h"
|
|
|
|
+#include "mozilla/Compression.h"
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
namespace ots {
|
2018-07-24 23:09:00 +03:00
|
|
|
|
|
|
|
@@ -200,16 +200,17 @@ bool OpenTypeGLAT_v3::Parse(const uint8_
|
|
|
|
if (prevent_decompression) {
|
2017-08-12 02:36:12 +03:00
|
|
|
return DropGraphite("Illegal nested compression");
|
|
|
|
}
|
2017-09-07 20:40:59 +03:00
|
|
|
std::vector<uint8_t> decompressed(this->compHead & FULL_SIZE);
|
|
|
|
- int ret = LZ4_decompress_safe_partial(
|
|
|
|
+ size_t outputSize = 0;
|
|
|
|
+ bool ret = mozilla::Compression::LZ4::decompressPartial(
|
|
|
|
reinterpret_cast<const char*>(data + table.offset()),
|
2017-08-12 02:36:12 +03:00
|
|
|
- reinterpret_cast<char*>(decompressed.data()),
|
2017-09-07 20:40:59 +03:00
|
|
|
table.remaining(), // input buffer size (input size + padding)
|
|
|
|
+ reinterpret_cast<char*>(decompressed.data()),
|
|
|
|
decompressed.size(), // target output size
|
|
|
|
- decompressed.size()); // output buffer size
|
2018-07-24 23:09:00 +03:00
|
|
|
- if (ret < 0 || unsigned(ret) != decompressed.size()) {
|
2017-08-12 02:36:12 +03:00
|
|
|
- return DropGraphite("Decompression failed with error code %d", ret);
|
2017-09-07 20:40:59 +03:00
|
|
|
+ &outputSize); // return output size
|
|
|
|
+ if (!ret || outputSize != decompressed.size()) {
|
2017-08-12 02:36:12 +03:00
|
|
|
+ return DropGraphite("Decompression failed");
|
|
|
|
}
|
|
|
|
return this->Parse(decompressed.data(), decompressed.size(), true);
|
|
|
|
}
|
2018-07-24 23:09:00 +03:00
|
|
|
default:
|
2017-08-12 02:36:12 +03:00
|
|
|
diff --git a/gfx/ots/src/silf.cc b/gfx/ots/src/silf.cc
|
|
|
|
--- a/gfx/ots/src/silf.cc
|
|
|
|
+++ b/gfx/ots/src/silf.cc
|
2018-07-24 23:09:00 +03:00
|
|
|
@@ -4,9 +4,9 @@
|
|
|
|
|
2017-08-12 02:36:12 +03:00
|
|
|
#include "silf.h"
|
|
|
|
|
|
|
|
#include "name.h"
|
|
|
|
-#include "lz4.h"
|
|
|
|
+#include "mozilla/Compression.h"
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
namespace ots {
|
2018-07-24 23:09:00 +03:00
|
|
|
|
|
|
|
@@ -38,16 +38,17 @@ bool OpenTypeSILF::Parse(const uint8_t*
|
|
|
|
if (prevent_decompression) {
|
2017-08-12 02:36:12 +03:00
|
|
|
return DropGraphite("Illegal nested compression");
|
|
|
|
}
|
2017-09-07 20:40:59 +03:00
|
|
|
std::vector<uint8_t> decompressed(this->compHead & FULL_SIZE);
|
|
|
|
- int ret = LZ4_decompress_safe_partial(
|
|
|
|
+ size_t outputSize = 0;
|
|
|
|
+ bool ret = mozilla::Compression::LZ4::decompressPartial(
|
|
|
|
reinterpret_cast<const char*>(data + table.offset()),
|
2017-08-12 02:36:12 +03:00
|
|
|
- reinterpret_cast<char*>(decompressed.data()),
|
2017-09-07 20:40:59 +03:00
|
|
|
table.remaining(), // input buffer size (input size + padding)
|
|
|
|
+ reinterpret_cast<char*>(decompressed.data()),
|
|
|
|
decompressed.size(), // target output size
|
|
|
|
- decompressed.size()); // output buffer size
|
2018-07-24 23:09:00 +03:00
|
|
|
- if (ret < 0 || unsigned(ret) != decompressed.size()) {
|
2017-08-12 02:36:12 +03:00
|
|
|
- return DropGraphite("Decompression failed with error code %d", ret);
|
2017-09-07 20:40:59 +03:00
|
|
|
+ &outputSize); // return output size
|
|
|
|
+ if (!ret || outputSize != decompressed.size()) {
|
2017-08-12 02:36:12 +03:00
|
|
|
+ return DropGraphite("Decompression failed");
|
|
|
|
}
|
|
|
|
return this->Parse(decompressed.data(), decompressed.size(), true);
|
|
|
|
}
|
2018-07-24 23:09:00 +03:00
|
|
|
default:
|