tesseract-5.5.2-1.fc44

List of Findings

Error: COMPILER_WARNING (CWE-457): [#def1]
tesseract-5.5.2/src/ccmain/fixspace.cpp:649:33: warning[-Wmaybe-uninitialized]: ‘worst_word_it.current’ may be used uninitialized
#  649 |   blob_it.set_to_list(word_res->word->cblob_list());
#      |                       ~~~~~~~~~~^~~~
tesseract-5.5.2/src/ccmain/fixspace.cpp:615:15: note: ‘worst_word_it.current’ was declared here
#  615 |   WERD_RES_IT worst_word_it;
#      |               ^~~~~~~~~~~~~
#  647|   
#  648|     new_blob_it.set_to_list(&new_blob_list);
#  649|->   blob_it.set_to_list(word_res->word->cblob_list());
#  650|     for (i = 0; i < worst_blob_index; i++, blob_it.forward()) {
#  651|       new_blob_it.add_after_then_move(blob_it.extract());

Error: COMPILER_WARNING: [#def2]
tesseract-5.5.2/src/ccmain/pageiterator.cpp: scope_hint: In member function ‘Pta* tesseract::PageIterator::BlockPolygon() const’
tesseract-5.5.2/src/ccmain/pageiterator.cpp:415:7: warning[-Wunused-but-set-variable=]: variable ‘num_pts’ set but not used
#  415 |   int num_pts = 0;
#      |       ^~~~~~~
#  413|     ICOORDELT_IT it(poly.points());
#  414|     Pta *pta = ptaCreate(it.length());
#  415|->   int num_pts = 0;
#  416|     for (it.mark_cycle_pt(); !it.cycled_list(); it.forward(), ++num_pts) {
#  417|       ICOORD *pt = it.data();

Error: CPPCHECK_WARNING (CWE-628): [#def3]
tesseract-5.5.2/src/ccstruct/detlinefit.cpp:124: warning[invalidFunctionArg]: Invalid sqrt() argument nr 1. The value is -1 but the valid values are '0.0:'.
#  122|     }
#  123|     // Finally compute the square root to return the true distance.
#  124|->   return best_uq > 0.0 ? sqrt(best_uq) : best_uq;
#  125|   }
#  126|   

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

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

Error: COMPILER_WARNING: [#def6]
tesseract-5.5.2/src/ccstruct/linlsq.h:126:15: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  126 |     for (auto i : v) {
#      |               ^
#  124|     bool offset_needed = stats.y_variance() < stats.x_variance();
#  125|     if (offset_needed) {
#  126|->     for (auto i : v) {
#  127|         i += halfrange;
#  128|       }

Error: COMPILER_WARNING: [#def7]
tesseract-5.5.2/src/ccstruct/linlsq.h:133:15: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  133 |     for (auto i : v) {
#      |               ^
#  131|     std::nth_element(v.begin(), v.begin() + median_index, v.end());
#  132|     if (offset_needed) {
#  133|->     for (auto i : v) {
#  134|         i -= halfrange;
#  135|       }

Error: COMPILER_WARNING (CWE-457): [#def8]
tesseract-5.5.2/src/ccutil/elst.h:361:20: warning[-Wmaybe-uninitialized]: ‘worst_word_it.prev’ may be used uninitialized
#  361 |         prev->next = new_element;
#      |         ~~~~~~~~~~~^~~~~~~~~~~~~
tesseract-5.5.2/src/ccmain/fixspace.cpp: scope_hint: In member function ‘tesseract::Tesseract::break_noisiest_blob_word(tesseract::WERD_RES_LIST&)’
tesseract-5.5.2/src/ccmain/fixspace.cpp:615:15: note: ‘worst_word_it.prev’ was declared here
#  615 |   WERD_RES_IT worst_word_it;
#      |               ^~~~~~~~~~~~~
#  359|           prev = next = new_element;
#  360|         } else {
#  361|->         prev->next = new_element;
#  362|           if (current) { // not extracted
#  363|             new_element->next = current;

Error: CPPCHECK_WARNING (CWE-457): [#def9]
tesseract-5.5.2/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): [#def10]
tesseract-5.5.2/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: [#def11]
tesseract-5.5.2/src/ccutil/unicharset.cpp:19: included_from: Included from here.
tesseract-5.5.2/src/ccutil/unicharset.h: scope_hint: In function ‘tesseract::CHAR_FRAGMENT::parse_from_string(char const*)’
tesseract-5.5.2/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: CPPCHECK_WARNING (CWE-401): [#def12]
tesseract-5.5.2/src/classify/clusttool.cpp:232: error[memleak]: Memory leak: Proto.Magnitude
#  230|         delete Proto;
#  231|         tprintf("Invalid prototype style\n");
#  232|->       return nullptr;
#  233|     }
#  234|     return Proto;

Error: CPPCHECK_WARNING (CWE-401): [#def13]
tesseract-5.5.2/src/classify/clusttool.cpp:232: error[memleak]: Memory leak: Proto.Variance
#  230|         delete Proto;
#  231|         tprintf("Invalid prototype style\n");
#  232|->       return nullptr;
#  233|     }
#  234|     return Proto;

Error: CPPCHECK_WARNING (CWE-401): [#def14]
tesseract-5.5.2/src/classify/clusttool.cpp:232: error[memleak]: Memory leak: Proto.Weight
#  230|         delete Proto;
#  231|         tprintf("Invalid prototype style\n");
#  232|->       return nullptr;
#  233|     }
#  234|     return Proto;

Error: CPPCHECK_WARNING (CWE-476): [#def15]
tesseract-5.5.2/src/dict/dawg.cpp:85: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: word_file
#   83|     }
#   84|   
#   85|->   while (fgets(string, CHARS_PER_LINE, word_file) != nullptr) {
#   86|       chomp_string(string); // remove newline
#   87|       WERD_CHOICE word(string, unicharset);

Error: CPPCHECK_WARNING (CWE-476): [#def16]
tesseract-5.5.2/src/dict/dict.cpp:705: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: doc_word_file
#  703|         ASSERT_HOST(doc_word_file);
#  704|       }
#  705|->     fprintf(doc_word_file, "%s\n", best_choice.debug_string().c_str());
#  706|       fclose(doc_word_file);
#  707|     }

Error: CPPCHECK_WARNING (CWE-476): [#def17]
tesseract-5.5.2/src/dict/dict.cpp:706: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: doc_word_file
#  704|       }
#  705|       fprintf(doc_word_file, "%s\n", best_choice.debug_string().c_str());
#  706|->     fclose(doc_word_file);
#  707|     }
#  708|     document_words_->add_word_to_dawg(best_choice);

Error: CPPCHECK_WARNING (CWE-476): [#def18]
tesseract-5.5.2/src/training/cntraining.cpp:211: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: File
#  209|     File = fopen(Filename.c_str(), "wb");
#  210|     ASSERT_HOST(File);
#  211|->   fprintf(File, "%0d\n", feature_desc->NumParams);
#  212|     WriteParamDesc(File, feature_desc->NumParams, feature_desc->ParamDesc);
#  213|     iterate(LabeledProtoList) {

Error: CPPCHECK_WARNING (CWE-476): [#def19]
tesseract-5.5.2/src/training/cntraining.cpp:225: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: File
#  223|         exit(1);
#  224|       }
#  225|->     fprintf(File, "\n%s %d\n", LabeledProto->Label.c_str(), N);
#  226|       WriteProtos(File, feature_desc->NumParams, LabeledProto->List, true, false);
#  227|     }

Error: CPPCHECK_WARNING (CWE-476): [#def20]
tesseract-5.5.2/src/training/cntraining.cpp:228: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: File
#  226|       WriteProtos(File, feature_desc->NumParams, LabeledProto->List, true, false);
#  227|     }
#  228|->   fclose(File);
#  229|   
#  230|   } // WriteNormProtos

Error: COMPILER_WARNING (CWE-195): [#def21]
tesseract-5.5.2/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.5.2/src/training/common/errorcounter.cpp:67:39: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<tesseract::Image>::size_type’ {aka ‘long unsigned int’}
#   67 |         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#      |                            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#   65|       int page_index = mutable_sample->page_num();
#   66|       Image page_pix =
#   67|->         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#   68|       // No debug, no keep this.
#   69|       classifier->UnicharClassifySample(*mutable_sample, page_pix, 0, INVALID_UNICHAR_ID, &results);

Error: COMPILER_WARNING (CWE-195): [#def22]
tesseract-5.5.2/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.5.2/src/training/common/errorcounter.cpp:131:39: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<tesseract::Image>::size_type’ {aka ‘long unsigned int’}
#  131 |         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#      |                            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#  129|       int page_index = mutable_sample->page_num();
#  130|       Image page_pix =
#  131|->         0 <= page_index && page_index < page_images.size() ? page_images[page_index] : nullptr;
#  132|       // No debug, no keep this.
#  133|       old_classifier->UnicharClassifySample(*mutable_sample, page_pix, 0, INVALID_UNICHAR_ID,

Error: COMPILER_WARNING (CWE-195): [#def23]
tesseract-5.5.2/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.5.2/src/training/common/errorcounter.cpp:420:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
#  420 |     for (int u = 0; u < multi_unichar_counts_.size(); ++u) {
#      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  418|       }
#  419|       tprintf("Multi-unichar shape use:\n");
#  420|->     for (int u = 0; u < multi_unichar_counts_.size(); ++u) {
#  421|         if (multi_unichar_counts_[u] > 0) {
#  422|           tprintf("%d multiple answers for unichar: %s\n", multi_unichar_counts_[u],

Error: COMPILER_WARNING (CWE-195): [#def24]
tesseract-5.5.2/src/training/common/mastertrainer.cpp: scope_hint: In member function ‘void tesseract::MasterTrainer::ClusterShapes(int, int, float, tesseract::ShapeTable*)’
tesseract-5.5.2/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): [#def25]
tesseract-5.5.2/src/training/common/trainingsampleset.cpp: scope_hint: In member function ‘void tesseract::TrainingSampleSet::SetupFontIdMap()’
tesseract-5.5.2/src/training/common/trainingsampleset.cpp:598:20: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘const int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
#  598 |     while (font_id >= font_counts.size()) {
#      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#  596|     for (auto &sample : samples_) {
#  597|       const int font_id = sample->font_id();
#  598|->     while (font_id >= font_counts.size()) {
#  599|         font_counts.push_back(0);
#  600|       }

Error: COMPILER_WARNING (CWE-195): [#def26]
tesseract-5.5.2/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.5.2/src/training/unicharset/lstmtrainer.cpp:1215:27: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} and ‘int’
# 1215 |   if (truth_labels.size() > targets->Width()) {
#      |       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# 1213|                                        const std::vector<int> &truth_labels,
# 1214|                                        NetworkIO *targets) {
# 1215|->   if (truth_labels.size() > targets->Width()) {
# 1216|       tprintf("Error: transcription %s too long to fit into target of width %d\n",
# 1217|               DecodeLabels(truth_labels).c_str(), targets->Width());

Error: COMPILER_WARNING (CWE-195): [#def27]
tesseract-5.5.2/src/ccutil/unicharset.h:22: included_from: Included from here.
tesseract-5.5.2/src/training/unicharset/unicharset_training_utils.cpp:32: included_from: Included from here.
tesseract-5.5.2/src/training/unicharset/unicharset_training_utils.cpp: scope_hint: In function ‘void tesseract::SetupBasicProperties(bool, bool, UNICHARSET*)’
tesseract-5.5.2/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.5.2/src/ccutil/errcode.h:57:4: note: in definition of macro ‘ASSERT_HOST’
#   57 |   (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): [#def28]
tesseract-5.5.2/src/training/unicharset/unicharset_training_utils.cpp: scope_hint: In function ‘void tesseract::SetScriptProperties(const std::string&, UNICHARSET*)’
tesseract-5.5.2/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.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-68.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nametesseract-5.5.2-1.fc44
store-results-to/tmp/tmpv9k5isdd/tesseract-5.5.2-1.fc44.tar.xz
time-created2026-01-08 22:00:56
time-finished2026-01-08 22:09:18
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpv9k5isdd/tesseract-5.5.2-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpv9k5isdd/tesseract-5.5.2-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9