Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

CborValidateTagUse rejects valid tag 1 (epoch) with a floating-point value, and restricts tags 21-23 too much

未关闭 适合新手
#339 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@thiagomacieira 已经在做这个了。

开始于 2026年10月2日。

  • #340 来自 @thiagomacieira —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
backend

调研方向

检查 src/cborvalidation.c 和 knownTagData 表,然后跟踪 cbor_value_validate 如何应用 CborValidateTagUse。使用整数和浮点值测试 tag 1,并使用不同的内容类型测试 tags 21–23;完成的标准是这些有效的 RFC 8949 用例返回 CborNoError,同时现有的限制仍得到覆盖。

由索引模型根据 Issue 内容生成。

描述

CborValidateTagUse refuses valid CBOR for two groups of tags, because of the knownTagData table in src/cborvalidation.c (checked at main, 213155c8, and in the v7.0 release).

Tag 1 (epoch-based date/time) with a float
{ 1, (uint32_t)(CborIntegerType+1) },

allows only an integer. RFC 8949 §3.4.2 says:

The tag content MUST be an unsigned or negative integer (major types 0 and 1) or a floating-point number (major type 7 with additional information 25, 26, or 27).

So RFC 8949's own Appendix A example 1(1363896240.5), c1fb41d452d9ec200000, fails validation with CborErrorInappropriateTagForType:

static const uint8_t item[] = {0xc1, 0xfb, 0x41, 0xd4, 0x52, 0xd9, 0xec, 0x20, 0x00, 0x00};
CborParser parser;
CborValue it;
cbor_parser_init(item, sizeof item, 0, &parser, &it);
CborError err = cbor_value_validate(&it, CborValidateTagUse);
/* err == CborErrorInappropriateTagForType; expected CborNoError */

The same happens for a half or single-precision float under tag 1.

Tags 21, 22 and 23

These entries allow only a byte string, array or map. RFC 8949 §3.4.5.2 says:

The data item tagged can be a byte string or any other data item.

So, for example, 21("text") (d5 64 74 65 78 74) or 23(1) (d7 01) is refused, although it is valid.

Suggested fix
  • Tag 1: allow CborHalfFloatType, CborFloatType and CborDoubleType alongside the integer.
  • Tags 21–23: give them no type restriction, as tag 55799 has.

(Found while writing conformance tests for an R binding of TinyCBOR, zucbor, which now checks tag content itself as a workaround.)

主要语言
C
星标
641
派生
222
平均合并
21 小时 33 分钟
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

intel/tinycbor 的其他 Issue

查看 intel/tinycbor 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。