infinite loop if char is unsigned

Bug #655821 reported by Jakub Wilk on 2010-10-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cuneiform for Linux
Undecided
Unassigned

Bug Description

make_limits function (Kern/rstr/src/cutpoint.c) falls into an infinite loop if the "char" type is unsigned. (Whether it is signed or unsigned is implementation defined, and it's in fact unsigned by default on some architectures.)

Because there are probably many other places where it is assumed thar "char" is signed, I propose the following work-around:

if(CMAKE_COMPILER_IS_GNUCC)
    add_definitions("-fsigned-char")
endif()

Jussi Pakkanen (jpakkane) wrote :

On the other hand, there are several places in the code that seem to assume that char is unsigned. These include switch clauses for character where the compared character has value larger than 127. These currently produce several "comparison always false due to out-of-range value" errors.

Daniel Wildermuth ist bis zum 15.Oktober 2010 nicht im Büro. In dringenden
Fällen bitte Marco Schmid(<email address hidden>) kontaktieren.

Daniel Wildermuth is out of Office until October 15th 2010. Is it urgent ?
Then please contact Marco Schmid(<email address hidden>))

Daniel Wildermuth ist bis zum 15.Oktober 2010 nicht im Büro. In dringenden
Fällen bitte Marco Schmid(<email address hidden>) kontaktieren.

Daniel Wildermuth is out of Office until October 15th 2010. Is it urgent ?
Then please contact Marco Schmid(<email address hidden>))

Daniel Wildermuth ist bis zum 15.Oktober 2010 nicht im Büro. In dringenden
Fällen bitte Marco Schmid(<email address hidden>) kontaktieren.

Daniel Wildermuth is out of Office until October 15th 2010. Is it urgent ?
Then please contact Marco Schmid(<email address hidden>))

Daniel Wildermuth ist bis zum 15.Oktober 2010 nicht im Büro. In dringenden
Fällen bitte Marco Schmid(<email address hidden>) kontaktieren.

Daniel Wildermuth is out of Office until October 15th 2010. Is it urgent ?
Then please contact Marco Schmid(<email address hidden>))

Jussi Pakkanen (jpakkane) wrote :

On Linux -funsigned-char works on some images (but worsens recognition results) and crashes on others.

>On Linux -funsigned-char works on some images (but worsens recognition
>results) and crashes on others.

Yes, that's why I proposed forcibly using -fsigned-char.

--
Jakub Wilk

Jussi Pakkanen (jpakkane) wrote :

I suspect that there are several bugs at work here. Some that make it crash with unsigned and some that make it work with signed, even though it was not supposed to. (As I discussed above, some parts of the code seem to expect unsigned chars.)

Unfortunately I can't see any simple solution to this.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers