Safer memory usage and some cleanups#30
Merged
Merged
Conversation
Validate image dimensions/channel counts before allocation and fail fast on invalid inputs. Add checked size arithmetic to prevent overflow when computing buffer sizes. Return consistent error/null paths to avoid partial allocation states and reduce OOB/memory-corruption risk. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
Use matching allocator/free pairs across wrapper boundaries to prevent cross-heap frees. Add null checks around image accessors and wrapper entry points, returning safe defaults/errors instead of dereferencing invalid pointers. This stabilizes wrapper behavior under failed/optional allocations. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
Normalize resize return/status handling so failures are propagated correctly. Replace unchecked copy/size-multiply paths with overflow-checked arithmetic and bounded copies. This prevents silent truncation, invalid buffer sizing, and potential memory safety issues in resize flows. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
Add explicit precondition checks before DMA/UART transfers (non-null handles and buffers, valid length, ready state). Reject invalid transfer requests early and return deterministic errors instead of invoking HAL with bad state. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
Ensure realloc copy logic only copies the valid overlap region and never reads past the old allocation. Preserve original buffer on allocation failure and avoid state loss/leaks on error paths. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
Replace legacy GPIO speed definitions with the current STM32 HAL GPIO speed frequency macros. - GPIO_SPEED_FAST -> GPIO_SPEED_FREQ_HIGH - GPIO_SPEED_HIGH -> GPIO_SPEED_FREQ_VERY_HIGH Signed-off-by: Ozan Durgut <ozndrgt@gmail.com>
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.
No description provided.