Compare commits

...

No commits in common. "c8s" and "c8-beta" have entirely different histories.
c8s ... c8-beta

7 changed files with 5 additions and 158 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
/tessdata-4.0.0.tar.gz
/tesseract-4.1.1.tar.gz
SOURCES/tessdata-4.0.0.tar.gz
SOURCES/tesseract-4.1.1.tar.gz

2
.tesseract.metadata Normal file
View File

@ -0,0 +1,2 @@
94557a6ecdf8ff8bec131598759e7d3b0bca1911 SOURCES/tessdata-4.0.0.tar.gz
25318bb3f57ef72d5736730739451673f4a66f51 SOURCES/tesseract-4.1.1.tar.gz

View File

@ -2,7 +2,7 @@
Name: tesseract
Version: 4.1.1
Release: 3%{?dist}
Release: 2%{?dist}
Summary: Raw OCR Engine
License: ASL 2.0
@ -13,8 +13,6 @@ Source1: https://github.com/tesseract-ocr/tessdata/archive/%{tessdata_vers
# Tweak location of tessdata folder
Patch0: tesseract_datadir.patch
Patch1: upstream_2f4d2f4bf45c363785d7bf1da29b6628f8939a72.patch
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: libtiff-devel
@ -269,7 +267,6 @@ trained models for the Tesseract Open Source OCR Engine.\
%prep
%setup -q -n %{name}-%{version} -a1
%patch0 -p1
%patch1 -p1
%build
@ -335,9 +332,6 @@ cp -av tessdata-%{tessdata_version}/* %{buildroot}%{_datadir}/%{name}/tessdata
%changelog
* Tue Aug 25 2026 Pavol Sloboda <psloboda@redhat.com> - 4.1.1-3
- Resolves: CVE-2026-73066
* Fri Aug 06 2021 Jiri Kucera <jkucera@redhat.com> - 4.1.1-2
- Fix subpackages deps
Related: #1826085

View File

@ -1,6 +0,0 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}

View File

@ -1,2 +0,0 @@
SHA512 (tessdata-4.0.0.tar.gz) = cd71bb99d44eefb53b359ba64b472c509fff773b2737a8d51e10d5d52d9a3a7ff870d470b1c72a7c78be3263b5ecfbb58a6eab13cf7128d8599681676cdcef6b
SHA512 (tesseract-4.1.1.tar.gz) = 017723a2268be789fe98978eed02fd294968cc8050dde376dee026f56f2b99df42db935049ae5e72c4519a920e263b40af1a6a40d9942e66608145b3131a71a2

View File

@ -1,141 +0,0 @@
From 2f4d2f4bf45c363785d7bf1da29b6628f8939a72 Mon Sep 17 00:00:00 2001
From: Stefan Weil <sw@weilnetz.de>
Date: Thu, 23 Jul 2026 18:05:39 +0200
Subject: [PATCH] Fix integer overflow in LSTM Convolve and Reconfig
deserialization (#4588)
Add range and overflow validation in Convolve::DeSerialize and
Reconfig::DeSerialize to prevent a crafted .traineddata file from
triggering a heap out-of-bounds write via unchecked signed integer
multiplication when computing the output-channel count.
Validate ni/no/num_weights in Network::CreateFromFile.
Add defense-in-depth bounds assertions in NetworkIO::Randomize and
NetworkIO::CopyTimeStepGeneral.
Reported-by: Eunho Kim <eunhok98@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Assisted-by: OpenCode / big-pickle (opencode)
Tested-by: Eunho Kim <eunhok98@gmail.com>
---
src/lstm/convolve.cpp | 24 +++++++++++++++++++++++-
src/lstm/network.cpp | 6 ++++++
src/lstm/networkio.cpp | 2 ++
src/lstm/reconfig.cpp | 20 +++++++++++++++++++-
4 files changed, 50 insertions(+), 2 deletions(-)
diff -Naur tesseract-4.1.1/src/lstm/convolve.cpp tesseract-4.1.1_patched/src/lstm/convolve.cpp
--- tesseract-4.1.1/src/lstm/convolve.cpp 2019-12-26 15:21:51.000000000 +0100
+++ tesseract-4.1.1_patched/src/lstm/convolve.cpp 2026-08-25 14:47:24.313114215 +0200
@@ -20,8 +20,11 @@
#include "convolve.h"
+#include <cstdint>
+
#include "networkscratch.h"
#include "serialis.h"
+#include "tprintf.h"
namespace tesseract {
@@ -41,7 +44,26 @@
bool Convolve::DeSerialize(TFile* fp) {
if (!fp->DeSerialize(&half_x_)) return false;
if (!fp->DeSerialize(&half_y_)) return false;
- no_ = ni_ * (2*half_x_ + 1) * (2*half_y_ + 1);
+ if (half_x_ < 0 || half_y_ < 0 || ni_ <= 0) {
+ tprintf("Error: invalid Convolve parameters: ni=%d half_x=%d half_y=%d\n", ni_, half_x_,
+ half_y_);
+ return false;
+ }
+ int64_t kx = 2LL * half_x_ + 1;
+ int64_t ky = 2LL * half_y_ + 1;
+ // Stepwise overflow check: ni_ * kx * ky must fit in int.
+ if (kx > INT_MAX / ky) {
+ tprintf("Error: Convolve output-channel count overflows: ni=%d half_x=%d half_y=%d\n", ni_,
+ half_x_, half_y_);
+ return false;
+ }
+ int64_t kxky = kx * ky;
+ if (static_cast<int64_t>(ni_) > INT_MAX / kxky) {
+ tprintf("Error: Convolve output-channel count overflows: ni=%d half_x=%d half_y=%d\n", ni_,
+ half_x_, half_y_);
+ return false;
+ }
+ no_ = static_cast<int>(static_cast<int64_t>(ni_) * kxky);
return true;
}
diff -Naur tesseract-4.1.1/src/lstm/network.cpp tesseract-4.1.1_patched/src/lstm/network.cpp
--- tesseract-4.1.1/src/lstm/network.cpp 2019-12-26 15:21:51.000000000 +0100
+++ tesseract-4.1.1_patched/src/lstm/network.cpp 2026-08-25 14:54:20.292420396 +0200
@@ -205,6 +205,11 @@
if (!fp->DeSerialize(&no)) return nullptr;
if (!fp->DeSerialize(&num_weights)) return nullptr;
if (!name.DeSerialize(fp)) return nullptr;
+ if (ni < 0 || no < 0 || num_weights < 0) {
+ tprintf("Error: invalid network layer parameters: type=%d ni=%d no=%d num_weights=%d\n", type,
+ ni, no, num_weights);
+ return nullptr;
+ }
switch (type) {
case NT_CONVOLVE:
diff -Naur tesseract-4.1.1/src/lstm/networkio.cpp tesseract-4.1.1_patched/src/lstm/networkio.cpp
--- tesseract-4.1.1/src/lstm/networkio.cpp 2019-12-26 15:21:51.000000000 +0100
+++ tesseract-4.1.1_patched/src/lstm/networkio.cpp 2026-08-25 14:56:16.484956294 +0200
@@ -394,6 +394,7 @@
int num_features, const NetworkIO& src,
int src_t, int src_offset) {
ASSERT_HOST(int_mode_ == src.int_mode_);
+ ASSERT_HOST(dest_offset + num_features <= NumFeatures());
if (int_mode_) {
memcpy(i_[dest_t] + dest_offset, src.i_[src_t] + src_offset,
num_features * sizeof(i_[0][0]));
@@ -415,6 +416,7 @@
// Sets the given range to random values.
void NetworkIO::Randomize(int t, int offset, int num_features,
TRand* randomizer) {
+ ASSERT_HOST(offset + num_features <= NumFeatures());
if (int_mode_) {
int8_t* line = i_[t] + offset;
for (int i = 0; i < num_features; ++i)
diff -Naur tesseract-4.1.1/src/lstm/reconfig.cpp tesseract-4.1.1_patched/src/lstm/reconfig.cpp
--- tesseract-4.1.1/src/lstm/reconfig.cpp 2019-12-26 15:21:51.000000000 +0100
+++ tesseract-4.1.1_patched/src/lstm/reconfig.cpp 2026-08-25 14:58:17.673474891 +0200
@@ -18,6 +18,10 @@
#include "reconfig.h"
+#include <cstdint>
+
+#include "tprintf.h"
+
namespace tesseract {
Reconfig::Reconfig(const STRING& name, int ni, int x_scale, int y_scale)
@@ -57,7 +61,21 @@
bool Reconfig::DeSerialize(TFile* fp) {
if (!fp->DeSerialize(&x_scale_)) return false;
if (!fp->DeSerialize(&y_scale_)) return false;
- no_ = ni_ * x_scale_ * y_scale_;
+ if (x_scale_ <= 0 || y_scale_ <= 0 || ni_ <= 0) {
+ tprintf("Error: invalid Reconfig parameters: ni=%d x_scale=%d y_scale=%d\n", ni_, x_scale_,
+ y_scale_);
+ return false;
+ }
+ int64_t xs = x_scale_;
+ int64_t ys = y_scale_;
+ // Stepwise overflow check: ni_ * x_scale_ * y_scale_ must fit in int.
+ int64_t xsys = xs * ys;
+ if (static_cast<int64_t>(ni_) > INT_MAX / xsys) {
+ tprintf("Error: Reconfig output-channel count overflows: ni=%d x_scale=%d y_scale=%d\n", ni_,
+ x_scale_, y_scale_);
+ return false;
+ }
+ no_ = static_cast<int>(static_cast<int64_t>(ni_) * xsys);
return true;
}