[UDFS] Initialize all local variables to prevent 0xCCCCCCCC in MSVC debug builds#23
Open
Zero3K20 wants to merge 7 commits into
Open
[UDFS] Initialize all local variables to prevent 0xCCCCCCCC in MSVC debug builds#23Zero3K20 wants to merge 7 commits into
Zero3K20 wants to merge 7 commits into
Conversation
Initialize all uninitialized local variables in the UDFS driver to prevent MSVC debug builds from filling them with 0xCCCCCCCC: - NTSTATUS/NTSTATUS variables initialized to STATUS_SUCCESS - BOOLEAN variables initialized to FALSE - ULONG/pointer variables initialized to 0/NULL Also restore accidentally removed code: - if (!FileInfo) check in UDFIndexDirectory (dirtree.cpp) - PUDF_FILE_INFO curFileInfo declaration in UDFPackDirectory__ (dirtree.cpp) - PAGED_CODE() calls in misc.cpp and volinfo.cpp - Comment in misc.cpp AcquireResource function Agent-Logs-Url: https://github.com/Zero3K20/reactos/sessions/901376db-4acd-42eb-8122-cce62735117e Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
Initialize all uninitialized local variables in the Include/ support files: Sys_spec_lib.cpp, phys_lib.cpp, regtools.cpp, mem_tools.cpp, string_lib.cpp. Covers NTSTATUS, BOOLEAN, ULONG, and pointer variables. Agent-Logs-Url: https://github.com/Zero3K20/reactos/sessions/a5f32228-fa19-4fba-bf7a-cdde18e904ec Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
7459fd0 to
39968cb
Compare
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.
MSVC debug builds fill uninitialized stack variables with
0xCCCCCCCC. In kernel drivers this is dangerous: an uninitializedBOOLEANreads asTRUE(non-zero), causing_SEH2_FINALLYcleanup blocks to release locks or resources that were never acquired.Changes
STATUS_SUCCESSFALSE0NULLCovers 31 files across the driver (
cleanup.cpp,create.cpp,fileinfo.cpp,fscntrl.cpp,misc.cpp,read.cpp,write.cpp,udf_info/dirtree.cpp,udf_info/extent.cpp,udf_info/mount.cpp,udf_info/udf_info.cpp, and others) as well as the support libraries in theInclude/directory (Sys_spec_lib.cpp,phys_lib.cpp,regtools.cpp,mem_tools.cpp,string_lib.cpp).Notable bug-class fixes
Acquisition flags in
_SEH2_FINALLYblocks — if0xCCCCCCCC, these appearTRUEand release resources never acquired:UDFSetRenameInfocounters —DirRefCount,FileInfoRefCount,IgnoreCase,UseCloseused in loop logic before guaranteed assignment.Include/support libraries —NTSTATUSreturn values,BOOLEANstatus flags,ULONGloop/search variables, and pointer variables inphys_lib.cpp,regtools.cpp,mem_tools.cpp,Sys_spec_lib.cpp, andstring_lib.cpp.