Menu

#285 Debug assertion fires in CoolPrj's TSyntaxParser for isalnum etc.

unspecified
open
nobody
1
2022-01-21
2014-11-16
No

Because of not handling the conversion of char to int in the calls to the isalnum (int) function (and similar character characterisation functions in the C++ standard library), a character code greater than 127 is converted to a negative number not accepted by these functions, thus causing an assertion exception in debug mode (and undefined behaviour in release mode).

For example, this issue can be observed in OWLMaker by opening source files with extended ASCII codes.

Related

Bugs: #388
Discussion: CoolEdit and C++Builder

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2018-03-18
    • labels: CoolPrj, Internal --> CoolPrj, Internal, OWLMaker
     
  • Vidar Hasfjord

    Vidar Hasfjord - 2018-03-18

    This issue may also be related to [bugs:#154] "dumpstack.cpp crashes in CoolEdit" (now deleted).

    Opening "owlcore/dumpstack.cpp" in OWLMaker crashes CoolEdit syntax highlighting.

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2022-01-21

    Using the debug version of the latest OWLMaker Build 5746, I have tested opening and browsing through a great number (many hundreds) of syntax-highlighted source code files (C++, DOS scripts, make files, resource files, etc.), many of which contain extended characters with the upper bit set (Norwegian and Faroese text using code page Windows-1252), as well as a few big binary files that presumably include the whole 8-bit range of character codes, and I cannot recreate any debug assertions.

    The code still passes arguments of type char to isalnum, isspace and similar functions, which expects type int. I can see no relevant changes in the CoolPrj make file (in particular, there is no new option that disables assertions in the standard library, and no option that changes the default signed-ness of type char ). So perhaps something has changed in Microsoft's implementation of the standard C++ library, since it no longer complains about a negative argument for these functions.

    I will leave this ticket open for now. But I recommend it is reviewed and closed as part of the ongoing overhaul of the CoolPrj code. See [feature-requests:#54].

    PS. OWLMaker Build 5746 and the underlying OWLNext 7.1 library were built in ANSI mode with VS 2020 version 17.0.5.

     
    👍
    1

    Related

    Feature Requests: #54


Log in to post a comment.