Abstract reader/writer issue with non-contigous input data
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 领域
- embedded-iot
调研方向
首先跟踪 CborParserOperations 及其 transfer_string 函数在 cbor_value_copy_text_string 中的调用路径,然后比较 cbor_value_advance 和 cbor_value_get_type 对两个 CborValue 对象的行为。复现所提供的非连续迭代器示例,最好将其缩减为最小案例;当原始值和输出的下一个值按描述推进且不出现 CborErrorIllegalType 时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
So I think this may be related to and/or covered by #208 , but I wanted to open an issue to report the specifics of what i am seeing.
I think the root of the issue is that in the structure CborParserOperations the function pointer transfer_string should advance the cursor but when calling CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, size_t *buflen, CborValue *next) the cursor should be advanced for the output parameter next but not advanced in the in-out parameter value. I think the user data token* is shared between copies of CborValue.
I am working in an embedded system and transitioning some existing code to use a struct netbuff like structure instead of just copying around worst-case sized buffers. To do this i need to move all my code to work on iterators instead of just taking a std::span<uint8_t> (we are on C++20). The iterators to this new structure are bidirectional_iterator, so no random access.
A simple (exposition only) example of the code that fails:
detail::ParserState<InItr, S> cbor_parse;
CborValue it;
cbor_parse.init(data.begin(), data.end(), it);
CborValue it2;
char func_name_buff[10]{};
size_t name_len = 10;
if (!cbor_value_is_text_string(&it)) {
return BadValue;
}
if (auto err = cbor_value_copy_text_string(&it, func_name_buff, &name_len, &it2) != CborNoError) {
return err;
}
auto errr = cbor_value_advance(&it); // ERROR: CborErrorIllegalType
auto type = cbor_value_get_type(&it) // CborTextStringType, should be NullType after the advance
auto type2 = cbor_value_get_type(&it2) // CborNullType
I will work on getting a minimal reproducible example into compiler explorer, especially if this is a new case.
- 主要语言
- C
- 星标
- 640
- 派生
- 222
- 平均合并
- 41 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
intel/tinycbor 的其他 Issue
-
CborValidateTagUse rejects valid tag 1 (epoch) with a floating-point value, and restricts tags 21-23 too much可能已有人在做 @thiagomacieira 于 19 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
Fixing CI/CD未关闭
难度 2/5 1-3 小时 新手友好度 25/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
interpreter-core type-feature
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
category:port-update
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
Update OpenBSD CI to OpenBSD 8.0 and vmactions/openbsd-vm v1.4.9可能已有人在做 @hyoklee 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 85/100
维护者通常 2 天内回复