Fixes to track design manager#8
Merged
IntelOrca merged 2 commits intoIntelOrca:feature/multiple-trackdesign-locationsfrom May 6, 2016
Merged
Fixes to track design manager#8IntelOrca merged 2 commits intoIntelOrca:feature/multiple-trackdesign-locationsfrom
IntelOrca merged 2 commits intoIntelOrca:feature/multiple-trackdesign-locationsfrom
Conversation
Fix errorneous sizeof() argument, skip unneeded memset
| uint8 *readPtr = src; | ||
|
|
||
| // Clear top of track_design as this is not loaded from the td4 files | ||
| memset(&td6->track_spine_colour, 0, 67); |
Collaborator
Author
There was a problem hiding this comment.
This memset has wrong argument: tries to set 67 bytes of a 4-byte item and is not needed, as the space for object has been calloced.
Owner
There was a problem hiding this comment.
Its not wrong, its setting several fields - not just that one. But as you say, it should already by zeroed by calloc.
Name of ride can be set to a string of variable length, like in `track_design_open` it gets set to the variable length filename. In `ride_set_name`, however, the ride name is accessed as if it was 36-bytes long anyway. This makes sure all 36 bytes are available for accessing.
IntelOrca
pushed a commit
that referenced
this pull request
Mar 10, 2018
While looking at OpenRCT2#7176 (comment) I got a crash with stacktrace: OpenRCT2#0 0x7f9e81fa2e30 in object_entry_get_entry(int, unsigned long) ../src/openrct2/object/ObjectList.cpp:181 #1 0x7f9e81fa24ae in get_loaded_object_entry(unsigned long) ../src/openrct2/object/ObjectList.cpp:142 #2 0x7f9e8215d64f in S6Exporter::Export() ../src/openrct2/rct2/S6Exporter.cpp:169 #3 0x7f9e8216de71 in scenario_save(char const*, int) ../src/openrct2/rct2/S6Exporter.cpp:757 #4 0x7f9e81c932b0 in game_autosave() ../src/openrct2/Game.cpp:1590 #5 0x7f9e828625b6 in scenario_autosave_check() ../src/openrct2/scenario/Scenario.cpp:297 #6 0x7f9e81c8a958 in game_update() ../src/openrct2/Game.cpp:439 #7 0x7f9e81c6731f in OpenRCT2::Context::Update() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f331f) #8 0x7f9e81c6674c in OpenRCT2::Context::RunVariableFrame() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f274c) #9 0x7f9e81c6402d in OpenRCT2::Context::RunFrame() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10f002d) #10 0x7f9e81c638f4 in OpenRCT2::Context::RunGameLoop() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10ef8f4) #11 0x7f9e81c627bf in OpenRCT2::Context::Launch() (/home/janisozaur/workspace/OpenRCT2/build/libopenrct2.so+0x10ee7bf) #12 0x7f9e81c5b08a in OpenRCT2::Context::RunOpenRCT2(int, char const**) ../src/openrct2/Context.cpp:170 #13 0x56323695b95e in main ../src/openrct2-ui/Ui.cpp:60 Sadly I cannot reproduce it anymore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix errorneous sizeof() argument, skip unneeded memset