Skip to content

Safer memory usage and some cleanups#30

Merged
ozan956 merged 6 commits into
mainfrom
feature/safer-ops
May 11, 2026
Merged

Safer memory usage and some cleanups#30
ozan956 merged 6 commits into
mainfrom
feature/safer-ops

Conversation

@ozan956
Copy link
Copy Markdown
Contributor

@ozan956 ozan956 commented Apr 28, 2026

No description provided.

ozan956 added 5 commits April 29, 2026 00:09
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>
@ozan956 ozan956 self-assigned this Apr 28, 2026
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>
@ozan956 ozan956 merged commit 3fd6857 into main May 11, 2026
1 check passed
@ozan956 ozan956 deleted the feature/safer-ops branch May 11, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant