FreeRTOS-Kernel/portable
AniruddhaKanhere 3d4227479d heap_1: reject configTOTAL_HEAP_SIZE <= portBYTE_ALIGNMENT at compile time
Defect: pvPortMalloc() in heap_1.c can return a pointer outside the ucHeap
array when configTOTAL_HEAP_SIZE is configured smaller than or equal to
portBYTE_ALIGNMENT.

Root cause: configADJUSTED_HEAP_SIZE is defined as
( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ). When configTOTAL_HEAP_SIZE is
not larger than portBYTE_ALIGNMENT this unsigned subtraction underflows to a
very large size_t value. The "enough room left" check in pvPortMalloc()
compares an unsigned index against configADJUSTED_HEAP_SIZE, so the underflowed
value defeats the check and an allocation can be handed out past the end of the
heap array.

Fix: add a compile-time (compiler, not preprocessor) size check so a
nonsensical, too-small heap is rejected during the build. The compiler-level
check still works when configTOTAL_HEAP_SIZE is defined with a cast such as
( ( size_t ) 0x2000 ).

A host regression test kept outside this repository demonstrates the fault
before the change and its absence afterwards (red then green).
2026-07-13 14:24:57 -07:00
..
ARMClang Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
ARMv8M Fix vPortFreeSecureContext to read xSecureContext at correct offset (#1441) 2026-07-01 10:58:41 -07:00
BCC/16BitDOS Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
CCRH/F1Kx Pass core ID to port lock macros (#1212) 2024-12-30 14:28:49 +05:30
CCS Move configASSERT default definition above before including portable.h. (#1185) 2024-11-04 16:35:52 +05:30
CodeWarrior Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
Common fix: Add MPU wrapper for xTimerDelete API (#1412) 2026-07-08 17:38:51 -07:00
GCC Fix vPortFreeSecureContext to read xSecureContext at correct offset (#1441) 2026-07-01 10:58:41 -07:00
IAR Fix vPortFreeSecureContext to read xSecureContext at correct offset (#1441) 2026-07-01 10:58:41 -07:00
Keil Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00
MemMang heap_1: reject configTOTAL_HEAP_SIZE <= portBYTE_ALIGNMENT at compile time 2026-07-13 14:24:57 -07:00
MikroC/ARM_CM4F Move configASSERT default definition above before including portable.h. (#1185) 2024-11-04 16:35:52 +05:30
MPLAB MPLAB PIC32MZ-EF - Adds an assert to catch register overflow (#1265) (#1267) 2025-04-25 17:05:15 +05:30
MSVC-MingW Fix undefined behavior from signed left-shift in MSVC-MingW port (#1411) 2026-05-06 16:11:51 -07:00
oWatcom/16BitDOS Fix spelling typos (#1168) 2024-11-01 10:09:49 -07:00
Paradigm/Tern_EE Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
Renesas Move configASSERT default definition above before including portable.h. (#1185) 2024-11-04 16:35:52 +05:30
Rowley Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
RVDS Disallow unprivileged critical sections with MPU wrappers v2 (#1427) 2026-06-15 15:30:25 -07:00
SDCC/Cygnal Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
Softune Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
Tasking/ARM_CM4F Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
template Pass core ID to port lock macros (#1212) 2024-12-30 14:28:49 +05:30
ThirdParty Add Arm China STAR-MC3 port support (#1363) 2026-02-20 10:33:34 -08:00
WizC/PIC18 Fix spelling typos (#1168) 2024-11-01 10:09:49 -07:00
CMakeLists.txt Add Arm China STAR-MC3 port support (#1363) 2026-02-20 10:33:34 -08:00
readme.txt Normalize line endings and whitespace in source files 2022-11-29 15:38:47 -08:00

Each real time kernel port consists of three files that contain the core kernel
components and are common to every port, and one or more files that are
specific to a particular microcontroller and/or compiler.


+ The FreeRTOS/Source/Portable/MemMang directory contains the five sample
memory allocators as described on the https://www.FreeRTOS.org WEB site.

+ The other directories each contain files specific to a particular
microcontroller or compiler, where the directory name denotes the compiler
specific files the directory contains.



For example, if you are interested in the [compiler] port for the [architecture]
microcontroller, then the port specific files are contained in
FreeRTOS/Source/Portable/[compiler]/[architecture] directory.  If this is the
only port you are interested in then all the other directories can be
ignored.