tesseract-5.4.1-5.fc42

List of Findings

Error: COMPILER_WARNING: [#def1]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccmain/applybox.cpp: scope_hint: In member function ‘FindSegmentation’
tesseract-5.4.1-build/tesseract-5.4.1/src/ccmain/applybox.cpp:548:66: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
#  548 |   auto *choices = new std::vector<BLOB_CHOICE_LIST *>[word_length];
#      |                                                                  ^
/usr/include/c++/14/new:133:26: note: in a call to allocation function ‘operator new []’ declared here
#  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
#      |                          ^
#  546|     // Classify all required combinations of blobs and save results in choices.
#  547|     const int word_length = word_res->box_word->length();
#  548|->   auto *choices = new std::vector<BLOB_CHOICE_LIST *>[word_length];
#  549|     for (int i = 0; i < word_length; ++i) {
#  550|       for (int j = 1; j <= kMaxGroupSize && i + j <= word_length; ++j) {

Error: CPPCHECK_WARNING (CWE-476): [#def2]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccstruct/imagedata.cpp:69: warning[nullPointer]: Possible null pointer dereference: imagedata
#   67|     // TODO: optimize resize (no init).
#   68|     image_data->image_data_.resize(imagedatasize);
#   69|->   memcpy(&image_data->image_data_[0], imagedata, imagedatasize);
#   70|     if (!image_data->AddBoxes(box_text)) {
#   71|       if (truth_text == nullptr || truth_text[0] == '\0') {

Error: CPPCHECK_WARNING (CWE-476): [#def3]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccstruct/imagedata.cpp:605: warning[nullPointer]: Possible null pointer dereference: image_data
#  603|         }
#  604|         pages_.push_back(image_data);
#  605|->       if (image_data->imagefilename().empty()) {
#  606|           image_data->set_imagefilename(document_name_);
#  607|           image_data->set_page_number(page);

Error: CPPCHECK_WARNING (CWE-457): [#def4]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/genericvector.h:773: error[uninitvar]: Uninitialized variable: empty
#  771|     }
#  772|     T empty;
#  773|->   init_to_size(reserved, empty);
#  774|     for (int i = 0; i < reserved; ++i) {
#  775|       if (!data_[i].DeSerialize(fp)) {

Error: CPPCHECK_WARNING (CWE-398): [#def5]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/unicharset.cpp:218: error[containerOutOfBounds]: Out of bounds access in expression 'lengths[0]' because 'lengths' is empty.
#  216|       return 0;
#  217|     }
#  218|->   return lengths[0];
#  219|   }
#  220|   

Error: COMPILER_WARNING: [#def6]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/unicharset.cpp:19: included_from: Included from here.
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/unicharset.h: scope_hint: In function ‘tesseract::CHAR_FRAGMENT::parse_from_string(char const*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/unicharset.h:67:12: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 30 bytes from a string of length 30
#   67 |     strncpy(this->unichar, uch, sizeof(this->unichar));
#      |            ^
#   65|     }
#   66|     inline void set_unichar(const char *uch) {
#   67|->     strncpy(this->unichar, uch, sizeof(this->unichar));
#   68|       this->unichar[UNICHAR_LEN] = '\0';
#   69|     }

Error: COMPILER_WARNING: [#def7]
tesseract-5.4.1-build/tesseract-5.4.1/src/textord/bbgrid.h: scope_hint: In member function ‘Init’
tesseract-5.4.1-build/tesseract-5.4.1/src/textord/bbgrid.h:492:11: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
#  492 |   grid_ = new BBC_CLIST[gridbuckets_];
#      |           ^
/usr/include/c++/14/new:133:26: note: in a call to allocation function ‘operator new []’ declared here
#  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
#      |                          ^
#  490|     GridBase::Init(gridsize, bleft, tright);
#  491|     delete[] grid_;
#  492|->   grid_ = new BBC_CLIST[gridbuckets_];
#  493|   }
#  494|   

Error: COMPILER_WARNING: [#def8]
tesseract-5.4.1-build/tesseract-5.4.1/src/textord/colpartitiongrid.cpp: scope_hint: In member function ‘MakeColPartSets’
tesseract-5.4.1-build/tesseract-5.4.1/src/textord/colpartitiongrid.cpp:804:56: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
#  804 |   auto *part_lists = new ColPartition_LIST[gridheight()];
#      |                                                        ^
/usr/include/c++/14/new:133:26: note: in a call to allocation function ‘operator new []’ declared here
#  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
#      |                          ^
#  802|   // for finding column bounds. Returns false if no partitions were found.
#  803|   bool ColPartitionGrid::MakeColPartSets(PartSetVector *part_sets) {
#  804|->   auto *part_lists = new ColPartition_LIST[gridheight()];
#  805|     part_sets->reserve(gridheight());
#  806|     // Iterate the ColPartitions in the grid to get parts onto lists for the

Error: COMPILER_WARNING: [#def9]
tesseract-5.4.1-build/tesseract-5.4.1/src/textord/topitch.cpp:1218:74: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
# 1218 |   std::unique_ptr<STATS[]> sum_proj(new STATS[textord_pitch_range * 2 + 1]); // summed projection
#      |                                                                          ^
/usr/include/c++/14/new: scope_hint: In function ‘tune_row_pitch’
/usr/include/c++/14/new:133:26: note: in a call to allocation function ‘operator new []’ declared here
#  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
#      |                          ^
# 1216|       return initial_pitch;
# 1217|     }
# 1218|->   std::unique_ptr<STATS[]> sum_proj(new STATS[textord_pitch_range * 2 + 1]); // summed projection
# 1219|   
# 1220|     for (pitch_delta = -textord_pitch_range; pitch_delta <= textord_pitch_range; pitch_delta++) {

Error: COMPILER_WARNING (CWE-195): [#def10]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp: scope_hint: In static member function ‘static double tesseract::ErrorCounter::ComputeErrorRate(tesseract::ShapeClassifier*, int, tesseract::CountTypes, const tesseract::FontInfoTable&, const std::vector<tesseract::Image>&, tesseract::SampleIterator*, double*, double*, std::string*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp:63:39: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<tesseract::Image>::size_type’ {aka ‘long unsigned int’}
#   63 |         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#      |                            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#   61|       int page_index = mutable_sample->page_num();
#   62|       Image page_pix =
#   63|->         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#   64|       // No debug, no keep this.
#   65|       classifier->UnicharClassifySample(*mutable_sample, page_pix, 0, INVALID_UNICHAR_ID, &results);

Error: COMPILER_WARNING (CWE-195): [#def11]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp: scope_hint: In static member function ‘static void tesseract::ErrorCounter::DebugNewErrors(tesseract::ShapeClassifier*, tesseract::ShapeClassifier*, tesseract::CountTypes, const tesseract::FontInfoTable&, const std::vector<tesseract::Image>&, tesseract::SampleIterator*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp:127:39: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<tesseract::Image>::size_type’ {aka ‘long unsigned int’}
#  127 |         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#      |                            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#  125|       int page_index = mutable_sample->page_num();
#  126|       Image page_pix =
#  127|->         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#  128|       // No debug, no keep this.
#  129|       old_classifier->UnicharClassifySample(*mutable_sample, page_pix, 0, INVALID_UNICHAR_ID,

Error: COMPILER_WARNING (CWE-195): [#def12]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp: scope_hint: In member function ‘double tesseract::ErrorCounter::ReportErrors(int, tesseract::CountTypes, const tesseract::FontInfoTable&, const tesseract::SampleIterator&, double*, std::string*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/errorcounter.cpp:416:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
#  416 |     for (int u = 0; u < multi_unichar_counts_.size(); ++u) {
#      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  414|       }
#  415|       tprintf("Multi-unichar shape use:\n");
#  416|->     for (int u = 0; u < multi_unichar_counts_.size(); ++u) {
#  417|         if (multi_unichar_counts_[u] > 0) {
#  418|           tprintf("%d multiple answers for unichar: %s\n", multi_unichar_counts_[u],

Error: COMPILER_WARNING: [#def13]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/mastertrainer.cpp: scope_hint: In member function ‘ClusterShapes.constprop’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/mastertrainer.cpp:972:60: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
#  972 |   auto *shape_dists = new std::vector<ShapeDist>[num_shapes];
#      |                                                            ^
/usr/include/c++/14/new:133:26: note: in a call to allocation function ‘operator new []’ declared here
#  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
#      |                          ^
#  970|     int max_merges = num_shapes - min_shapes;
#  971|     // TODO: avoid new / delete.
#  972|->   auto *shape_dists = new std::vector<ShapeDist>[num_shapes];
#  973|     float min_dist = kInfiniteDist;
#  974|     int min_s1 = 0;

Error: COMPILER_WARNING (CWE-195): [#def14]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/mastertrainer.cpp: scope_hint: In member function ‘void tesseract::MasterTrainer::ClusterShapes(int, int, float, tesseract::ShapeTable*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/mastertrainer.cpp:1037:46: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’
# 1037 |       if (shapes->MasterDestinationIndex(s1) == s1) {
#      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
# 1035|     if (debug_level_ > 1) {
# 1036|       for (int s1 = 0; s1 < num_shapes; ++s1) {
# 1037|->       if (shapes->MasterDestinationIndex(s1) == s1) {
# 1038|           tprintf("Master shape:%s\n", shapes->DebugStr(s1).c_str());
# 1039|         }

Error: COMPILER_WARNING (CWE-195): [#def15]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/trainingsampleset.cpp: scope_hint: In member function ‘void tesseract::TrainingSampleSet::SetupFontIdMap()’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/common/trainingsampleset.cpp:596:20: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘const int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
#  596 |     while (font_id >= font_counts.size()) {
#      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#  594|     for (auto &sample : samples_) {
#  595|       const int font_id = sample->font_id();
#  596|->     while (font_id >= font_counts.size()) {
#  597|         font_counts.push_back(0);
#  598|       }

Error: COMPILER_WARNING (CWE-195): [#def16]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/lstmtrainer.cpp: scope_hint: In member function ‘bool tesseract::LSTMTrainer::ComputeTextTargets(const tesseract::NetworkIO&, const std::vector<int>&, tesseract::NetworkIO*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/lstmtrainer.cpp:1235:27: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} and ‘int’
# 1235 |   if (truth_labels.size() > targets->Width()) {
#      |       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# 1233|                                        const std::vector<int> &truth_labels,
# 1234|                                        NetworkIO *targets) {
# 1235|->   if (truth_labels.size() > targets->Width()) {
# 1236|       tprintf("Error: transcription %s too long to fit into target of width %d\n",
# 1237|               DecodeLabels(truth_labels).c_str(), targets->Width());

Error: COMPILER_WARNING (CWE-195): [#def17]
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/unicharset.h:22: included_from: Included from here.
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/unicharset_training_utils.cpp:32: included_from: Included from here.
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/unicharset_training_utils.cpp: scope_hint: In function ‘void tesseract::SetupBasicProperties(bool, bool, UNICHARSET*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/unicharset_training_utils.cpp:139:56: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘tesseract::UNICHAR_ID’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
#  139 |     ASSERT_HOST(unicharset->get_other_case(unichar_id) < unicharset->size());
#      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
tesseract-5.4.1-build/tesseract-5.4.1/src/ccutil/errcode.h:55:4: note: in definition of macro ‘ASSERT_HOST’
#   55 |   (x) ? DO_NOTHING : ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", __FILE__, __LINE__)
#      |    ^
#  137|         unicharset->set_normed(unichar_id, unichar_str);
#  138|       }
#  139|->     ASSERT_HOST(unicharset->get_other_case(unichar_id) < unicharset->size());
#  140|     }
#  141|     unicharset->post_load_setup();

Error: COMPILER_WARNING (CWE-195): [#def18]
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/unicharset_training_utils.cpp: scope_hint: In function ‘void tesseract::SetScriptProperties(const std::string&, UNICHARSET*)’
tesseract-5.4.1-build/tesseract-5.4.1/src/training/unicharset/unicharset_training_utils.cpp:157:47: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
#  157 |   for (int c = SPECIAL_UNICHAR_CODES_COUNT; c < unicharset->size(); ++c) {
#      |                                             ~~^~~~~~~~~~~~~~~~~~~~
#  155|       }
#  156|     }
#  157|->   for (int c = SPECIAL_UNICHAR_CODES_COUNT; c < unicharset->size(); ++c) {
#  158|       if (unicharset->PropertiesIncomplete(c)) {
#  159|         tprintf("Warning: properties incomplete for index %d = %s\n", c,

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-253.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nametesseract-5.4.1-5.fc42
store-results-to/tmp/tmp86atpzti/tesseract-5.4.1-5.fc42.tar.xz
time-created2024-11-13 03:27:55
time-finished2024-11-13 03:37:27
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp86atpzti/tesseract-5.4.1-5.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp86atpzti/tesseract-5.4.1-5.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9