x2t: update to 9.1.0 (#462253)

This commit is contained in:
Arnout Engelen
2025-11-16 21:30:31 +00:00
committed by GitHub
5 changed files with 222 additions and 37 deletions

View File

@@ -0,0 +1,16 @@
diff --git a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp
index bacd5dedac..4749d8fecb 100644
--- a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp
+++ b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp
@@ -259,10 +259,7 @@ namespace NSJSBase
m_internal->m_contextPersistent.Reset();
// destroy native object in the weak handles before isolate disposal
v8::Isolate* isolate = m_internal->m_isolate;
- {
- v8::Isolate::Scope scope(isolate);
- isolate->VisitHandlesWithClassIds(WeakHandleVisitor::getInstance());
- }
+ std::cerr << "Could not release memory. This is a nix-specific leak, but should be fine as long as it doesn't happen too frequently" << std::endl;
isolate->Dispose();
m_internal->m_isolate = NULL;
}

View File

@@ -0,0 +1,76 @@
diff --git a/DesktopEditor/doctrenderer/test/json/main.cpp b/DesktopEditor/doctrenderer/test/json/main.cpp
index e5c6a0e52d..9b127a9c44 100644
--- a/DesktopEditor/doctrenderer/test/json/main.cpp
+++ b/DesktopEditor/doctrenderer/test/json/main.cpp
@@ -472,26 +472,26 @@ TEST_F(CJSONTest, image_externalize)
int width = 1080;
int height = 480;
BYTE* bits = CValue::AllocImageBits(width, height);
- CValue img = CValue::CreateImage(bits, width, height, ifBGRA);
+ CValue img = CValue::CreateImage(bits, width, height, ImageFormat::ifBGRA);
EXPECT_TRUE(img.IsImage());
EXPECT_EQ(img.GetImageBits(), bits);
EXPECT_EQ(img.GetImageWidth(), width);
EXPECT_EQ(img.GetImageHeight(), height);
- EXPECT_EQ(img.GetImageFormat(), ifBGRA);
+ EXPECT_EQ(img.GetImageFormat(), ImageFormat::ifBGRA);
CValue::FreeImageBits(bits);
width = 50;
height = 100;
bits = CValue::AllocImageBits(width, height);
- img = CValue::CreateImage(bits, width, height, ifRGBA);
+ img = CValue::CreateImage(bits, width, height, ImageFormat::ifRGBA);
EXPECT_TRUE(img.IsImage());
EXPECT_EQ(img.GetImageBits(), bits);
EXPECT_EQ(img.GetImageWidth(), width);
EXPECT_EQ(img.GetImageHeight(), height);
- EXPECT_EQ(img.GetImageFormat(), ifRGBA);
+ EXPECT_EQ(img.GetImageFormat(), ImageFormat::ifRGBA);
CValue::FreeImageBits(bits);
}
@@ -501,25 +501,25 @@ TEST_F(CJSONTest, image_not_externalize)
int width = 320;
int height = 480;
BYTE* bits = CValue::AllocImageBits(width, height);
- CValue img = CValue::CreateImage(bits, width, height, ifARGB, false);
+ CValue img = CValue::CreateImage(bits, width, height, ImageFormat::ifARGB, false);
EXPECT_TRUE(img.IsImage());
EXPECT_EQ(img.GetImageBits(), bits);
EXPECT_EQ(img.GetImageWidth(), width);
EXPECT_EQ(img.GetImageHeight(), height);
- EXPECT_EQ(img.GetImageFormat(), ifARGB);
+ EXPECT_EQ(img.GetImageFormat(), ImageFormat::ifARGB);
}
TEST_F(CJSONTest, image_wrong_size)
{
BYTE* bits = CValue::AllocImageBits(100, 100);
- CValue img = CValue::CreateImage(bits, 0, 100, ifARGB, false);
+ CValue img = CValue::CreateImage(bits, 0, 100, ImageFormat::ifARGB, false);
EXPECT_TRUE(img.IsUndefined());
- img = CValue::CreateImage(bits, -1, 100, ifARGB, false);
+ img = CValue::CreateImage(bits, -1, 100, ImageFormat::ifARGB, false);
EXPECT_TRUE(img.IsUndefined());
- img = CValue::CreateImage(bits, 0, 0, ifARGB, false);
+ img = CValue::CreateImage(bits, 0, 0, ImageFormat::ifARGB, false);
EXPECT_TRUE(img.IsUndefined());
- img = CValue::CreateImage(bits, -100, -100, ifARGB, false);
+ img = CValue::CreateImage(bits, -100, -100, ImageFormat::ifARGB, false);
EXPECT_TRUE(img.IsUndefined());
}
@@ -593,7 +593,7 @@ TEST_F(CJSONTest, wrong_usage)
EXPECT_EQ(val.GetCount(), 0);
EXPECT_EQ(val.GetData(), nullptr);
EXPECT_EQ(val.GetImageBits(), nullptr);
- EXPECT_EQ(val.GetImageFormat(), ifInvalid);
+ EXPECT_EQ(val.GetImageFormat(), ImageFormat::ifInvalid);
EXPECT_EQ(val.GetImageHeight(), 0);
EXPECT_EQ(val.GetImageWidth(), 0);
#endif

View File

@@ -0,0 +1,10 @@
diff --git a/OFDFile/test/main.cpp b/OFDFile/test/main.cpp
index 92189f10ff..7aff6df96f 100644
--- a/OFDFile/test/main.cpp
+++ b/OFDFile/test/main.cpp
@@ -1,4 +1,4 @@
-#include "../OfdFile.h"
+#include "../OFDFile.h"
#include <iostream>
#include "../../DesktopEditor/common/Directory.h"

View File

@@ -7,6 +7,9 @@
fetchFromGitHub,
glibc,
harfbuzz,
libheif,
x265,
libde265,
icu,
jdk,
lib,
@@ -28,7 +31,7 @@ let
fixIcu = writeScript "fix-icu.sh" ''
substituteInPlace \
$BUILDRT/Common/3dParty/icu/icu.pri \
--replace-fail "ICU_MAJOR_VER = 58" "ICU_MAJOR_VER = ${lib.versions.major icu.version}"
--replace-fail "ICU_MAJOR_VER = 74" "ICU_MAJOR_VER = ${lib.versions.major icu.version}"
mkdir $BUILDRT/Common/3dParty/icu/linux_64
ln -s ${icu}/lib $BUILDRT/Common/3dParty/icu/linux_64/build
@@ -46,6 +49,13 @@ let
rev = "be6df458d4540eee375c513958dcb862a391cdd1";
hash = "sha256-SYJFLtrg8raGyr3zQIEzZDjHDmMmt+K0po3viipZW5c=";
};
# see core/Common/3dParty/html/fetch.py
gumbo-parser-src = fetchFromGitHub {
owner = "google";
repo = "gumbo-parser";
rev = "aa91b27b02c0c80c482e24348a457ed7c3c088e0";
hash = "sha256-+607iXJxeWKoCwb490pp3mqRZ1fWzxec0tJOEFeHoCs=";
};
# see build_tools scripts/core_common/modules/googletest.py
googletest-src = fetchFromGitHub {
owner = "google";
@@ -61,12 +71,33 @@ let
rev = "73dd2967c8e1e4f6d7334ee9e539a323d6e66cbd";
hash = "sha256-WIHpSkOwHkhMvEKxOlgf6gsPs9T3xkzguD8ONXARf1U=";
};
# see core/Common/3dParty/html/fetch.py
gumbo-parser-src = fetchFromGitHub {
owner = "google";
repo = "gumbo-parser";
rev = "aa91b27b02c0c80c482e24348a457ed7c3c088e0";
hash = "sha256-+607iXJxeWKoCwb490pp3mqRZ1fWzxec0tJOEFeHoCs=";
# core/Common/3dParty/md/fetch.py
md4c-src = fetchFromGitHub {
owner = "mity";
repo = "md4c";
rev = "481fbfbdf72daab2912380d62bb5f2187d438408";
hash = "sha256-zhInM3R0CJUqnzh6wRxMwlUdErovplbZQ5IwXe9XzZ4=";
};
# core/Common/3dParty/apple/fetch.py
glm-src = fetchFromGitHub {
owner = "g-truc";
repo = "glm";
rev = "33b4a621a697a305bc3a7610d290677b96beb181";
hash = "sha256-wwGI17vlQzL/x1O0ANr5+KgU1ETnATpLw3njpKfjnKQ=";
};
# core/Common/3dParty/apple/fetch.py
mdds-src = fetchFromGitHub {
owner = "kohei-us";
repo = "mdds";
rev = "0783158939c6ce4b0b1b89e345ab983ccb0f0ad0";
hash = "sha256-HMGMxMRO6SadisUjZ0ZNBGQqksNDFkEh3yaQGet9rc0=";
};
# core/Common/3dParty/apple/fetch.py
librevenge-src = fetchFromGitHub {
owner = "DistroTech";
repo = "librevenge";
rev = "becd044b519ab83893ad6398e3cbb499a7f0aaf4";
hash = "sha256-2YRxuMYzKvvQHiwXH08VX6GRkdXnY7q05SL05Vbn0Vs=";
};
# core/Common/3dParty/apple/fetch.py
libodfgen-src = fetchFromGitHub {
@@ -75,24 +106,7 @@ let
rev = "8ef8c171ebe3c5daebdce80ee422cf7bb96aa3bc";
hash = "sha256-Bv/smZFmZn4PEAcOlXD2Z4k96CK7A7YGDHFDsqZpuiE=";
};
mdds-src = fetchFromGitHub {
owner = "kohei-us";
repo = "mdds";
rev = "0783158939c6ce4b0b1b89e345ab983ccb0f0ad0";
hash = "sha256-HMGMxMRO6SadisUjZ0ZNBGQqksNDFkEh3yaQGet9rc0=";
};
glm-src = fetchFromGitHub {
owner = "g-truc";
repo = "glm";
rev = "33b4a621a697a305bc3a7610d290677b96beb181";
hash = "sha256-wwGI17vlQzL/x1O0ANr5+KgU1ETnATpLw3njpKfjnKQ=";
};
librevenge-src = fetchFromGitHub {
owner = "DistroTech";
repo = "librevenge";
rev = "becd044b519ab83893ad6398e3cbb499a7f0aaf4";
hash = "sha256-2YRxuMYzKvvQHiwXH08VX6GRkdXnY7q05SL05Vbn0Vs=";
};
# core/Common/3dParty/apple/fetch.py
libetonyek-src = fetchFromGitHub {
owner = "LibreOffice";
repo = "libetonyek";
@@ -102,13 +116,15 @@ let
#qmakeFlags = [ "CONFIG+=debug" ];
qmakeFlags = [ ];
dontStrip = false;
core-rev = "d257c68d5fdd71a33776a291914f2c856426c259";
# Revisions that correspond to onlyoffice-documentserver 9.1.0
core-rev = "82e281cf6bf89498e4de6018423b36576706c2b6";
core = fetchFromGitHub {
owner = "ONLYOFFICE";
repo = "core";
# rev that the 'core' submodule in documentserver points at
rev = core-rev;
hash = "sha256-EXeqG8MJWS1asjFihnuMnDSHeKt2x+Ui+8MYK50AnSY=";
hash = "sha256-LzbO2A29WxM0XTAO2LGTtg9omL0Pvoh+6+q3ux4i7do=";
};
web-apps = buildNpmPackage (finalAttrs: {
name = "onlyoffice-core-webapps";
@@ -119,8 +135,8 @@ let
owner = "ONLYOFFICE";
repo = "web-apps";
# rev that the 'web-apps' submodule in documentserver points at
rev = "5255c27b1af64f6edf08d1aba20a23b8149e338c";
hash = "sha256-49v2h+ILQ0X/gNHny6LQcj94A6h7nS99liUAnLRNxzw=";
rev = "f63e9674a5d2d2e5a660ab726ec00a359fc3c750";
hash = "sha256-kKm6+phd6a7kP/kv6/v/FFgh96Kbs6h6jIjpFtRJgps=";
};
sourceRoot = "${finalAttrs.src.name}/build";
@@ -159,12 +175,16 @@ let
owner = "ONLYOFFICE";
repo = "sdkjs";
# rev that the 'sdkjs' submodule in documentserver points at
rev = "0e50652cb08c7753a9ab72d0558560ada5d43046";
hash = "sha256-fApr34aT0X8ffPwbsUEWnA3SK8pT5RKNan3YxzhvtAU=";
rev = "d169f841a7e9e46368c36236dd5820e3e10d4a98";
hash = "sha256-GQwzz3P49sWjCxh41zyuUs5MyMjBQXaMKzxUUTHq0UE=";
};
sourceRoot = "${finalAttrs.src.name}/build";
npmDepsHash = "sha256-Hpf+z3RGqZ1LTdow6xP00hNmWf4xs+KnVBj4NbPW4uM=";
postPatch = ''
cp npm-shrinkwrap.json package-lock.json
'';
npmDepsHash = "sha256-C+qp5d4wYmlrEGjIeBsjRhpivy6wKBppJWbcj1z9fbM=";
dontNpmBuild = true;
@@ -193,8 +213,8 @@ let
dictionaries = fetchFromGitHub {
owner = "ONLYOFFICE";
repo = "dictionaries";
tag = "v8.2.0.103";
hash = "sha256-3BwWAvnw0RCD6fxTCRstJSrF5QgfVNVBe8rN1hHhCoU=";
rev = "d3223bbb777883db66ac3cd249f71c6ebdc992c7";
hash = "sha256-7hvztNYnYjyOl3ynGP0vqtx9jLPp09XVDNIow1RYuWM=";
};
buildCoreComponent =
rootdir: attrs:
@@ -324,10 +344,22 @@ let
buildInputs = [
unicodeConverter
kernel
libheif.lib
x265
libde265
];
preConfigure = ''
ln -s ${katana-parser-src} $BUILDRT/Common/3dParty/html/katana-parser
mkdir -p $BUILDRT/Common/3dParty/heif/libheif/libheif
ln -s ${libheif.dev}/include $BUILDRT/Common/3dParty/heif/libheif/libheif/api
mkdir -p $BUILDRT/Common/3dParty/heif/libheif/build/linux_64/release
ln -s ${libheif.lib}/lib $BUILDRT/Common/3dParty/heif/libheif/build/linux_64/release/libheif
mkdir -p $BUILDRT/Common/3dParty/heif/x265_git/build/linux_64
ln -s ${x265}/lib $BUILDRT/Common/3dParty/heif/x265_git/build/linux_64/release
mkdir -p $BUILDRT/Common/3dParty/heif/libde265/build/linux_64/release
ln -s ${libde265}/lib $BUILDRT/Common/3dParty/heif/libde265/build/linux_64/release/libde265
# Common/3dParty/harfbuzz/make.py
cat >$BUILDRT/Common/3dParty/harfbuzz/harfbuzz.pri <<EOL
INCLUDEPATH += ${harfbuzz.dev}/include/harfbuzz
@@ -449,6 +481,28 @@ let
graphics
];
};
ofdfile = buildCoreComponent "OFDFile" {
buildInputs = [
boost
unicodeConverter
graphics
kernel
pdffile
];
passthru.tests = buildCoreTests "OFDFile/test" {
buildInputs = [
unicodeConverter
ofdfile
graphics
kernel
];
patches = [ ./ofdfile-test.patch ];
qmakeFlags = qmakeFlags ++ icuQmakeFlags;
preConfigure = ''
source ${fixIcu}
'';
};
};
pdffile = buildCoreComponent "PdfFile" {
buildInputs = [
graphics
@@ -457,6 +511,9 @@ let
cryptopp
network
];
patches = [
./pdffile-limits-include.patch
];
};
djvufile = buildCoreComponent "DjVuFile" {
buildInputs = [
@@ -466,6 +523,13 @@ let
pdffile
];
};
textcommandrenderer = buildCoreComponent "DocxRenderer/test/TextCommandRenderer" {
buildInputs = [
unicodeConverter
kernel
graphics
];
};
docxrenderer = buildCoreComponent "DocxRenderer" {
buildInputs = [
unicodeConverter
@@ -482,6 +546,7 @@ let
djvufile
xpsfile
docxrenderer
textcommandrenderer
];
preConfigure = ''
# (not as patch because of line endings)
@@ -515,6 +580,7 @@ let
# https://github.com/ONLYOFFICE/core/pull/1631
./doctrenderer-format-security.patch
./doctrenderer-config-dir.patch
./doctrenderer-v8-iterator.patch
./fontengine-format-security.patch
./v8_updates.patch
./common-v8-no-compress-pointers.patch
@@ -569,6 +635,7 @@ let
passthru.tests = lib.attrsets.genAttrs [ "embed/external" "embed/internal" "js_internal" "json" ] (
test:
buildCoreTests "DesktopEditor/doctrenderer/test/${test}" {
patches = [ ./doctrenderer-v8-test.patch ];
buildInputs = [ doctrenderer ];
preConfigure = ''
ln -s ${googletest-src} $BUILDRT/Common/3dParty/googletest/googletest
@@ -587,6 +654,7 @@ let
preConfigure = ''
ln -s ${katana-parser-src} $BUILDRT/Common/3dParty/html/katana-parser
ln -s ${gumbo-parser-src} $BUILDRT/Common/3dParty/html/gumbo-parser
ln -s ${md4c-src} $BUILDRT/Common/3dParty/md/md4c
'';
};
epubfile = buildCoreComponent "EpubFile" {
@@ -630,6 +698,7 @@ let
unicodeConverter
kernel
graphics
libheif.lib
];
qmakeFlags = qmakeFlags ++ icuQmakeFlags;
preConfigure = ''
@@ -648,8 +717,8 @@ let
core-fonts = fetchFromGitHub {
owner = "ONLYOFFICE";
repo = "core-fonts";
rev = "d5d80e6ae15800ccf31e1c4dbb1ae3385992e0c2";
hash = "sha256-daJG/4tcdRVVmlMCUW4iuoUkEEfY7sx5icYWMva4o+c=";
rev = "7030c6681fb5bbed560675cb42422f91df15d5c9";
hash = "sha256-yNUDyIJ09Ejbyt/kMrOpDbT15QTDOe7GTQChRU5+QY4=";
};
allfonts = runCommand "allfonts" { } ''
mkdir -p $out/web
@@ -669,7 +738,7 @@ buildCoreComponent "X2tConverter/build/Qt" {
pname = "x2t";
# x2t is not 'directly' versioned, so we version it after the version
# of documentserver it's pulled into as a submodule
version = "8.3.2";
version = "9.1.0";
buildInputs = [
unicodeConverter
@@ -698,6 +767,7 @@ buildCoreComponent "X2tConverter/build/Qt" {
docxrenderer
iworkfile
hwpfile
ofdfile
vbaformatlib
odfformatlib
];
@@ -740,6 +810,7 @@ buildCoreComponent "X2tConverter/build/Qt" {
iworkfile = iworkfile.tests;
docxrenderer = docxrenderer.tests;
doctrenderer = doctrenderer.tests;
ofdfile = ofdfile.tests;
x2t = runCommand "x2t-test" { } ''
(${x2t}/bin/x2t || true) | grep "OOX/binary file converter." && mkdir -p $out
'';

View File

@@ -0,0 +1,12 @@
diff --git a/PdfFile/SrcWriter/Utils.cpp b/PdfFile/SrcWriter/Utils.cpp
index f4fcd884c6..0454c2a75a 100644
--- a/PdfFile/SrcWriter/Utils.cpp
+++ b/PdfFile/SrcWriter/Utils.cpp
@@ -33,6 +33,7 @@
#include <vector>
#include <ctime>
#include <cwctype>
+#include <limits>
namespace PdfWriter
{