Comments (10)
I never had a NULL pointer deference in this function and never saw a bug report which reported one. Therefore I think the checks should be removed.
Do you want to send a pull request?
from tesseract.
I never had a NULL pointer deference in this function and never saw a bug report which reported one. Therefore I think the checks should be removed.
Do you want to send a pull request?
Yeah, I have send a pull request.
from tesseract.
From the name previous
it can be nullptr.
from tesseract.
From the name
previous
it can be nullptr.
But if the for loop is entered and previous
is nullptr
, it will inevitably cause a null pointer dereference. Currently, it seems there is no path where previous
would be nullptr
when entering the for loop. Or do you think an error handling branch should be added?
from tesseract.
From the name
previous
it can be nullptr.
Yes, but obviously the loop always terminates before the nullptr is reached. Otherwise we'd have lots of Tesseract crashes.
from tesseract.
From
for (int p = length - 1; p >= 0; --p, previous = previous->prev) {
to
for (int p = length - 1; p >= 0 && previous ; --p, previous = previous->prev) {
and remove checks from inside the loop.
from tesseract.
@egorpugin, would you prefer the nullptr check in the for statement although that case never occurred up to now?
from tesseract.
I just did a test with make check
and found that the body of the for loop is never executed because length
is always 0.
from tesseract.
@egorpugin, would you prefer the nullptr check in the for statement although that case never occurred up to now?
Yes.
And more than that is a question about this issue at all.
'Potential' dereference - potential not an issue?
Just do a quick refactor of cond inside for loop and that's enough.
You even discovered that the loop is not executed at all, so don't touch it or change semantics without knowing what it does or what it is for.
So, checking it for nullptr in the for statement LGTM.
from tesseract.
I updated the PR. Please review.
from tesseract.
Related Issues (20)
- Mac m1, not able to compile HOT 2
- OCR of Indian Currency Sign " ₹" HOT 2
- please support linux binary , like fzf HOT 1
- Infinite recursion for `tesseract --list-langs` with conda-forge binary HOT 16
- SW Pipeline for Ubuntu failed HOT 2
- text2image needs pango_training.so which in turn is not installed HOT 7
- Can not read input file in /tmp HOT 3
- Tesseract can not recognize grey text in black background HOT 1
- Multiple language detection within an image HOT 2
- Floating-point exception (SIGFPE) due to out-of-range input to asinf in Wordrec::angle_change HOT 4
- Openmp cannot be disabled HOT 4
- Dropout layers for Tesseract HOT 5
- Build system drags in "avx512" support on setup that does not support this instructions HOT 2
- Inconsistencies in detection and extraction of text using tesseract HOT 4
- Floating point exception with tessdata models since version 5.4.0 HOT 6
- Differences in image contrast, brightness, and sharpness can lead to different directions of ocr recognition HOT 3
- OCR from grayscale TIFFs produces inconsistent results HOT 3
- Inconsistencies, sometimes, on similar characters. Is there a list of mistakes for characters that are very similar? HOT 1
- Assert fail in src/ccstruct/pageres.cpp, line 1502 with specific image and language combination - all languages from ubuntu repos HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tesseract.