summaryrefslogtreecommitdiffstats
path: root/gfx/ots/ots-lz4.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/ots/ots-lz4.patch
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/ots/ots-lz4.patch')
-rw-r--r--gfx/ots/ots-lz4.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/gfx/ots/ots-lz4.patch b/gfx/ots/ots-lz4.patch
new file mode 100644
index 0000000000..4251e72d69
--- /dev/null
+++ b/gfx/ots/ots-lz4.patch
@@ -0,0 +1,74 @@
+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
+@@ -4,9 +4,9 @@
+
+ #include "glat.h"
+
+ #include "gloc.h"
+-#include "lz4.h"
++#include "mozilla/Compression.h"
+ #include <list>
+
+ namespace ots {
+
+@@ -212,16 +212,17 @@ bool OpenTypeGLAT_v3::Parse(const uint8_
+ return DropGraphite("Decompressed size exceeds 30MB: %gMB",
+ decompressed_size / (1024.0 * 1024.0));
+ }
+ std::vector<uint8_t> decompressed(decompressed_size);
+- int ret = LZ4_decompress_safe_partial(
++ size_t outputSize = 0;
++ bool ret = mozilla::Compression::LZ4::decompressPartial(
+ reinterpret_cast<const char*>(data + table.offset()),
+- reinterpret_cast<char*>(decompressed.data()),
+ table.remaining(), // input buffer size (input size + padding)
++ reinterpret_cast<char*>(decompressed.data()),
+ decompressed.size(), // target output size
+- decompressed.size()); // output buffer size
+- if (ret < 0 || unsigned(ret) != decompressed.size()) {
+- return DropGraphite("Decompression failed with error code %d", ret);
++ &outputSize); // return output size
++ if (!ret || outputSize != decompressed.size()) {
++ return DropGraphite("Decompression failed");
+ }
+ return this->Parse(decompressed.data(), decompressed.size(), true);
+ }
+ default:
+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
+@@ -4,9 +4,9 @@
+
+ #include "silf.h"
+
+ #include "name.h"
+-#include "lz4.h"
++#include "mozilla/Compression.h"
+ #include <cmath>
+
+ namespace ots {
+
+@@ -50,16 +50,17 @@ bool OpenTypeSILF::Parse(const uint8_t*
+ return DropGraphite("Decompressed size exceeds 30MB: %gMB",
+ decompressed_size / (1024.0 * 1024.0));
+ }
+ std::vector<uint8_t> decompressed(decompressed_size);
+- int ret = LZ4_decompress_safe_partial(
++ size_t outputSize = 0;
++ bool ret = mozilla::Compression::LZ4::decompressPartial(
+ reinterpret_cast<const char*>(data + table.offset()),
+- reinterpret_cast<char*>(decompressed.data()),
+ table.remaining(), // input buffer size (input size + padding)
++ reinterpret_cast<char*>(decompressed.data()),
+ decompressed.size(), // target output size
+- decompressed.size()); // output buffer size
+- if (ret < 0 || unsigned(ret) != decompressed.size()) {
+- return DropGraphite("Decompression failed with error code %d", ret);
++ &outputSize); // return output size
++ if (!ret || outputSize != decompressed.size()) {
++ return DropGraphite("Decompression failed");
+ }
+ return this->Parse(decompressed.data(), decompressed.size(), true);
+ }
+ default: