Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug in String::copy, out of bounds crash

オープン
#9,110 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
cpp
領域
embedded-iot

調査の方向性

cores/esp8266/WString.cpp の 280-291 行付近から始め、setLen および reserve と合わせて String::copy を調べてください。割り当て境界を引き起こす文字列長でクラッシュを再現し、終端 null 文字が常に割り当てられた配列内にあり、範囲外アクセスが発生しないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Basic Infos
  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.
Problem Description

See line 291 (and line 280):

https://github.com/esp8266/Arduino/blob/eda4e0855fa5ebcf1d7f621f35f25f6bab503335/cores/esp8266/WString.cpp#L284-L293

When allocating an array of N elements, accessing element [N] is out of bounds.

This only happens sometimes at very specific string lengths, as setLen only allocates in multiples of N bytes.

N.B. similar issue for ESP32, so I will also add an issue there.

Suggested fix:

reserve(length + 1);

N.B. This function is likely to be called with strlen() or strlen_P() as argument, which does not include the ending null character.

主要言語
C++
スター
16.7k
フォーク
13.1k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

esp8266/Arduino のほかの issue

esp8266/Arduino の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。