[BUG] xTaskCreate() unsigned integer overflow when calculating stack size
メンテナーはふだん 3 日以内に返信
@JacksonBopp がすでに取り組んでいます。
2026年9月5日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 20/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- c
調査の方向性
The overflow is in prvCreateTask() in FreeRTOS/Source/tasks.c, where uxStackDepth * sizeof(StackType_t) is passed to pvPortMallocStack(), and prvInitialiseNewTask() then uses the unchecked depth. Read the open pull requests #1488 and #1489 first, since they already target this bug, and check whether the discussion has settled the approach. Done means an overflow check before allocation that returns a creation failure, applied to every dynamic stack allocation path.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
xTaskCreate() accepts a task stack depth in words. On 32-bit Cortex-M ports, the default configSTACK_DEPTH_TYPE and size_t are both 32-bit, but the kernel allocates the stack using unchecked uxStackDepth * sizeof(StackType_t). An oversized depth wraps to a small allocation; initialization then retains the original depth and performs stack pointer arithmetic using that value.
Target
FreeRTOS revision 592732b4d
FreeRTOS/Source/tasks.c, prvCreateTask() and prvInitialiseNewTask()
Cortex-M7 default port: FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/portmacro.h
Host
- Host OS: Ubuntu 24
To Reproduce
On a 32-bit size_t / 32-bit StackType_t target, pass a depth greater than UINT32_MAX / 4; for example 0x40000020 words. The allocation expression wraps to 128 bytes, while prvInitialiseNewTask() computes a top-of-stack using pxStack[uxStackDepth - 1] and initializes the task from that original depth.
Expected behavior
The allocation-size multiplication is not checked before pvPortMallocStack(). The later initialization path assumes the requested word count was allocated.
Additional context
Before allocating, reject uxStackDepth > SIZE_MAX / sizeof(StackType_t) and return task-creation failure. Apply the same check to all dynamic stack allocation paths. A product should additionally impose a realistic maximum task-stack size at its API boundary.
- 主要言語
- C
- スター
- 4.6k
- フォーク
- 1.6k
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FreeRTOS/FreeRTOS-Kernel のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
FreeRTOS/FreeRTOS-Kernel#1520 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
FreeRTOS/FreeRTOS-Kernel#1494 · コメント 3 件 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
FreeRTOS/FreeRTOS-Kernel#1554 ·
メンテナーはふだん 3 日以内に返信
-
[BUG] event_wait_timed can't return false対応中かも @TedLyngmo が 39 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
FreeRTOS/FreeRTOS-Kernel#1546 ·
メンテナーはふだん 3 日以内に返信
FreeRTOS/FreeRTOS-Kernel の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
shinyquagsire23/OpenJKDF2#540 ·
メンテナーはふだん 12 日以内に返信
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Life-Framework/Life-Framework#5939 ·
メンテナーはふだん 1 日以内に返信
-
autoconf failes to find libsodium even when present due to implicit function declaration対応中かも @coderjoe が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 13 日以内に返信
-
Bug Status: Needs Triage
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug python
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
Jstar269/nakagawa-recomp#3521 ·
メンテナーはふだん 1 日以内に返信