Skip to content

Nethack 3.6.0.ctype fixes - #20

Closed
barthouse wants to merge 4 commits into
NetHack:NetHack-3.6.0from
barthouse:Nethack-3.6.0.ctype_fixes
Closed

barthouse wants to merge 4 commits into
NetHack:NetHack-3.6.0from
barthouse:Nethack-3.6.0.ctype_fixes

Conversation

@barthouse

Copy link
Copy Markdown
Contributor

This fixes a problem with the use of ctype utility functions (e.g. isspace). The ctype utility functions take an integer and expect them to be in a range of -1 to 255. If the input is out of range, the ctype library will assert in debug builds of NetHack. If we call a utility function with a signed char then we risk hitting this assert for extended characters. All calls to the ctype functions must ensure the argument passed is a uchar to avoid passing in a value that is out of range due to sign extension.

A 100% repro example of this problem can be found by the following:

  1. change your language settings to English UK allowing the entry of extended characters (like British pound)
  2. Launch new game of nethack with pet using debug version
  3. Name pet whose name starts with extended character followed by maximum number of other characters (no spaces)
  4. Name item in inventory same as pet
  5. Drop named item
  6. Move one space and wait for pet to pick up item
  7. When pet picks up item, you will assertion in update_topl() when calling isspace().

You can contact me at bart@barthouse.com.

@barthouse

Copy link
Copy Markdown
Contributor Author

Looks like the changes have been incorporated and this pull request is no longer required.

@barthouse barthouse closed this Dec 25, 2016
@barthouse
barthouse deleted the Nethack-3.6.0.ctype_fixes branch December 25, 2016 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants