infinite loop if char is unsigned

Bug #655821 reported by Jakub Wilk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cuneiform for Linux
New
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()

Revision history for this message
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.

Revision history for this message
daniel (daniel-schmid-engineering) wrote : Re: [Cuneiform] [Bug 655821] Re: infinite loop if char is unsigned

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>))

Revision history for this message
daniel (daniel-schmid-engineering) wrote : Re: Re: [Cuneiform] [Bug 655821] Re: infinite loop if char is unsigned

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>))

Revision history for this message
daniel (daniel-schmid-engineering) wrote : Re: Re: Re: [Cuneiform] [Bug 655821] Re: infinite loop if char is unsigned

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>))

Revision history for this message
daniel (daniel-schmid-engineering) wrote : Re: Re: Re: Re: [Cuneiform] [Bug 655821] Re: infinite loop if char is unsigned

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>))

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

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

Revision history for this message
Jakub Wilk (jwilk) wrote : Re: [Bug 655821] Re: infinite loop if char is unsigned

>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

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.