STR #731

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.1 ]

STR #731

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:2 - Specific to an operating system
Subsystem:Core Library
Summary:Negative value passed to isalpha() in Fl::handle()
Created By:syrja
Assigned To:mike
Fix Version:1.1.7 (SVN: v4064)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 syrja
01:58 Feb 25, 2005
fl.cxx line 699:

    {char* c = (char*)event_text(); // cast away const
    if (!isalpha(*c)) return 0;
    *c = isupper(*c) ? tolower(*c) : toupper(*c);}
    e_number = e = FL_SHORTCUT;

*c is signed char and passes values greater than 127 as negative
numbers to isalpha() function.

Because of assert inside msvcr71d.dll isalpha() function, this
crashes Windows Visual Studio 2003 debug builds, when pressing
finnish keyboard keys ä, ö and å.
#2 mike
11:24 Mar 05, 2005
Fixed in Subversion repository.

Changed char *c to unsigned char *c...
#3 spitzak
14:30 Mar 05, 2005


Sure fixing it is ok, but I don't think VC is obeying the c library standard. Certainly it was always intended to accept negative characters, the first C implementations did not have unsigned characters at all.
#4 mike
14:45 Mar 05, 2005

Actually, no, the behavior of is*() and to*() with negative integers other than EOF (-1) is undefined.  This is a real bug...

Unfortunately, the ANSI folks didn't bother defining a standard for the char type - it can be signed or unsigned by default...
bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.