Conversation
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.
This PR addresses several critical security and stability issues discovered during code review of the MigrateAnyData library. All fixes include regression tests where applicable.
Key Changes
1. Memory Safety Improvements
Remove dead NULL checks after new operator
newthrowsstd::bad_alloc, never returns NULLPrevent integer overflow in buffer size calculation
inttosize_tfor size calculationsKey files:
MigrateAnyData/MigrateAnyData.cpp2. Input Validation
Add zero division check for stored record size
GetSizeOfCurrentData()returns 0Add null checks for function pointers
MigrateUp,MigrateDown, andonMigrateDataItembefore invocationKey files:
MigrateAnyData/MigrateAnyData.cpp3. String Safety
Ensure null-termination in string field migration macros
strncpydoesn't guarantee null-termination when source is longer than bufferKey files:
MigrateAnyData/MigrateAnyData.h4. Tests
Added 3 new test cases:
TestError_Zero_Record_Size- validates zero size handlingTestError_Null_Migrate_Function- validates null function pointer handlingTestString_Field_Null_Termination- validates string macro safetyKey files:
Tests/Error_Zero_Record_Size.cpp,Tests/Error_Null_Migrate_Function.cpp,Tests/String_Field_Null_Termination.cpp,CMakeLists.txt5. CI Improvement
Added
--output-on-failureto ctest for better debugging in CI.Key files:
.github/workflows/cmake-multi-platform.yml