• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!
Waffle
Reaction score
8

Profile posts Latest activity Postings Experience Resources About

  • Hey, you wrote this:

    "eg the following could in rare cases be true and cause heisenbugs:
    StringHash(a) == StringHash(b) && StringHash(a) != StringHash(b)"

    Which edge cases do you mean?
    Waffle
    Waffle
    ... (split cuz 1k char limit..)

    this is the type of silent and rare type of data corruption that is very hard to detect .. also its ocurring conditions are verr particular/situational because they are dependent on data that changes form game to game.

    also you should know that there are way more possible strings than there are 32 bit integers thus there must be many strings whose hashes are the same. but since most maps use very few string it is very rare and thus the issue gets little press. thus not getting fixed and always putting everyone at risk without them realising it.
    Ezekiel12
    Ezekiel12
    I see what you mean, your posted code still can never be true.

    The problem you are describing all starts with hashtable taking integer as key, therefore the StringHash function has to return an integer.
    This is probably for performance reasons and to emulate the way gamecache was used in combination with the return bug until 2009. When that was found being able to virus other peoples PCs, hashtable and GetHandleId(...) was introduced.
    Waffle
    Waffle
    Precicely. in normal programming languages the key to a hashtable is the key object itself, but in jass it is instead an integer derived from the key object not the key object itself. (ofc hashtables all use integral hashes underneath the hood but having the actual key object as input allows for dealing with hash collisions transparently, since w3 hashtables do not store the key itself they are unable to deal with .. or even detect that such an issue has occurred)
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top