String::toInt() and atol() behave different on different platforms with a number that is too large.
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- cpp
- 领域
- embedded-iot
调研方向
从 String.cpp 中的 String::toInt() 开始,检查 atol() 对超出平台 long 范围的值的行为。在 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 ·