String::toInt() and atol() behave different on different platforms with a number that is too large.
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp
- 領域
- embedded-iot
調査の方向性
String.cpp の String::toInt() から始め、プラットフォームの long の範囲外の値に対して atol() がどのように動作するかを確認します。8-bit および 32-bit プラットフォーム全体で、提案されている strtol() と errno の処理を比較します。範囲を超える入力が、LONG_MAX や LONG_MIN を誤って扱うことなく、一貫した文書化済みの結果を生成すれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
User axemaster found strange behavior when using String::toInt() with a number that is too large. See the topic in the Arduino forum: https://forum.arduino.cc/t/toint-bug-how-unfortunate/1041669.
The result is different for 8-bit and 32-bit platforms.
It was narrowed down to the undefined behaviour of atol() when a number is too large to fit in a long.
The atol() in String::toInt() in String.cpp could be replaced by strtol() followed by a check for LONG_MAX or LONG_MIN and return zero if that happens. The documentation can stay as it is, because it will return a long, and zero if something is wrong.
To allow LONG_MAX and LONG_MIN as valid input numbers, the errno has to be used. I don't know how that will hold up in a multitasking environment.
- 主要言語
- C++
- スター
- 306
- フォーク
- 150
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
arduino/ArduinoCore-API のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
arduino/ArduinoCore-API#261 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 30/100
arduino/ArduinoCore-API#256 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
arduino/ArduinoCore-API#251 · コメント 1 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
arduino/ArduinoCore-API#250 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
arduino/ArduinoCore-API#249 ·
arduino/ArduinoCore-API の issue をすべて見る
似ている issue
-
ai_reviewed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ydb-platform/ydb#53869 · コメント 3 件 ·
-
bug cert blocker needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
project-chip/connectedhomeip#74373 ·
-
upstream update
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conan-io/conan-center-index#31035 ·
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
vllm-project/vllm-ascend#17329 ·