[3.5-dev] New refactored FOV crashes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2940

    [3.5-dev] New refactored FOV crashes

    See this commit: 9d48405fa5669b2419067dd0522512c5d5a77237 (Detect and work around the 'knight's move' LOS hack when doing FOV).

    Calls to cave_iswall(c, x + something, y + something) are suspicious for two reasons: first, the function declaration is cave_iswall(struct cave *c, int y, int x), which implies that y should go before x; second, the two parameters surely can go out of bounds when you inspect a grid that is near the border of the level, so maybe add some bound checking somewhere.
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2940

    #2
    It seems that the problem is more severe...

    Now I got random crashes when changing levels. I suspect an illegal access to cave->info somewhere. On my local copy of the source, I'm gonna do three things:
    - remove the byte_256 hack on cave->info and use byte_wid instead (I don't see anywhere in the source why cave->info has width 256 instead of DUNGEON_WID, it's probably a leftover from old code)
    - add access functions to all CAVE_XXX flags and put an assert(in_bounds) in them
    - fix asserts I'll get by putting in_bounds checks where the code lacks them
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

    Comment

    • AnonymousHero
      Veteran
      • Jun 2007
      • 1322

      #3
      Have you tried running under Valgrind?

      Comment

      • PowerWyrm
        Prophet
        • Apr 2008
        • 2940

        #4
        I finished refactoring the cave->info access code, and it seems that the only faulty code is the one mentioned in my first post ('knight's move' rule when updating FOV): calls to cave_iswall() are done with out of bounds coordinates when near the border of the level. Adding some bounds checking fixed the crash problems.
        PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

        Comment

        Working...
        😀
        😂
        🥰
        😘
        🤢
        😎
        😞
        😡
        👍
        👎