fix: fixACISFormat 改为显式长度入参,修正 npos 与越界读 #26

Merged
gjm merged 1 commits from company-desktop-computer/fix/acis-format-bounds AGit into main 2026-10-21 14:20:25 +08:00
Collaborator
  • 签名加 size_t nLen,内部用 std::string(pszReg, nLen) 构造,
    不再依赖调用方 buffer 的结尾 '\0';StringToRegion(nLen, char*)
    传入的 m_pSatBuffer 是 new byte[m_nSatLen],没有终止符,原写法会越界读
  • 首行解析改用 substr(0, find('\n')),去掉 stringstream 对终止符的依赖
  • pos == npos(数据里没有 '#')时返回 false,原写法 pos+1 溢出为 0,
    substr(0,0) 得到空串却仍返回 true,调用方会写出 0 字节文件且无提示
  • countOfRecord <= 0 时提前返回 false
- 签名加 size_t nLen,内部用 std::string(pszReg, nLen) 构造, 不再依赖调用方 buffer 的结尾 '\0';StringToRegion(nLen, char*) 传入的 m_pSatBuffer 是 new byte[m_nSatLen],没有终止符,原写法会越界读 - 首行解析改用 substr(0, find('\n')),去掉 stringstream 对终止符的依赖 - pos == npos(数据里没有 '#')时返回 false,原写法 pos+1 溢出为 0, substr(0,0) 得到空串却仍返回 true,调用方会写出 0 字节文件且无提示 - countOfRecord <= 0 时提前返回 false
company-desktop-computer added 1 commit 2026-10-21 14:15:25 +08:00
- 签名加 size_t nLen,内部用 std::string(pszReg, nLen) 构造,
  不再依赖调用方 buffer 的结尾 '\0';StringToRegion(nLen, char*)
  传入的 m_pSatBuffer 是 new byte[m_nSatLen],没有终止符,原写法会越界读
- 首行解析改用 substr(0, find('\n')),去掉 stringstream 对终止符的依赖
- pos == npos(数据里没有 '#')时返回 false,原写法 pos+1 溢出为 0,
  substr(0,0) 得到空串却仍返回 true,调用方会写出 0 字节文件且无提示
- countOfRecord <= 0 时提前返回 false
gjm approved these changes 2026-10-21 14:20:20 +08:00
gjm merged commit 10d1fc00c8 into main 2026-10-21 14:20:25 +08:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gjm/envi-code#26