Changes

From DoomWiki.org

Absurd texture name in error message

10 bytes added, 04:47, 15 May 2018
this doesn't actually affect R_FlatNumForName
When a map has a missing flat or texture, the game aborts with an error message, either [[Error message#R_FlatNumForName: %s not found|R_FlatNumForName: %s not found]] or [[Error message#R_TextureNumForName: %s not found|R_TextureNumForName: %s not found]].
In their data structures in memory, [[sidedef]]s pack the upper, middle, and lower [[texture]] names (in that order) in arrays of eight characters, without using a separator:
} mapsidedef_t;
[[Sector]]When a texture is missing, the error string is printed using the offending texture's name to be inserted as the <tt>%s pack floor and ceiling [[</tt> token. Since {{wp|C (programming_language)|C}} uses {{wp|null-terminated string}}s, if the texture or flat]] names name is full (it uses all eight characters available) then the formatting function will keep adding the next characters in memory until it finds a similar way: typedef struct { short floorheight; short ceilingheight; char floorpic[8]; char ceilingpic[8]; short lightlevel; short special; short tag; } mapsector_t;null byte.
When For example, if a sidedef is given a non-existent upper texture with a name using all eight characters, then the name of the next texture in order (middle texture ) will be appended (regardless of whether it is missing or flat not). If that one is missingalso full, the error string is printed using the offending lower texture's name to will be inserted as the <tt>%s</tt> tokenappended too. Since {{wp|C (programming_language)|C}} uses {{wp|null-terminated string}}s, And if the lower texture or flat name is full (it uses all eight , garbage characters available) then will be added as the sidedef's sector number is processed, followed by the formatting function will keep adding offsets, texture names, and sector number of the next characters in memory sidedef, and so on, until it finds a null byteis finally encountered, preferably before a {{wp|segmentation fault}} happens.
For example, The related function "R_FlatNumForName" displays a similar error if a sidedef is given sector has a non-existent upper texture with a name using all eight charactersnonexistent flat on its floor or ceiling, then but copies the name of the next texture in order (middle texture) will be appended (regardless of whether offending flat into a temporary buffer to ensure it is missing or not)printed correctly. If that one is also full, The oversight in R_TextureNumForName exists in all versions of the lower texture name will be appended too. And if the lower texture name is fullgame, garbage characters will be added as including the sidedef's sector number is processed[[Doom source code|source code]] release, followed by the offsets, texture names, and sector number of the next sidedef, and so on, until a null byte but is finally encountered, preferably before a {{wp|segmentation fault}} happensfixed in virtually all source ports.
[[Category:Errors and bugs]]
62
edits