Skip to content

fix: accept real hardware EDID header in big endian mode - #878

Closed
add-uos wants to merge 1 commit into
linuxdeepin:masterfrom
add-uos:agent/bug/2c6637dcc6b8
Closed

add-uos wants to merge 1 commit into
linuxdeepin:masterfrom
add-uos:agent/bug/2c6637dcc6b8

Conversation

@add-uos

@add-uos add-uos commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

fix: accept real hardware EDID header in big endian mode

  1. Root cause: big endian EDID header validation only accepts the
    standard VESA pattern "ff00ffffffff00ff", but real hardware EDID
    has 0xFF at byte 7 producing "ff00ffffffffffff" which fails the
    check and causes display info to be lost
  2. Fix: add a second startsWith check for the real hardware header
    pattern alongside the standard one, so both are accepted
  3. Impact: only relaxes the big endian header validation in setEdid,
    no signature change, no effect on little endian mode or parsing
    logic

Influence:

  1. Test standard VESA EDID header parsing in big endian mode
  2. Test real hardware EDID header parsing in big endian mode
  3. Verify little endian mode parsing is unaffected

fix: 兼容实机 EDID 大端模式头部校验

  1. 根因:大端模式 EDID 头部校验仅接受标准 VESA 模式
    "ff00ffffffff00ff",但实机第 7 字节为 0xFF 生成
    "ff00ffffffffffff",导致校验失败、显示器信息丢失
  2. 方案:在标准头部校验旁增加实机头部模式的 startsWith 检查,
    两种头部均被接受
  3. 影响:仅放宽 setEdid 大端模式头部校验,不改变函数签名,
    不影响小端模式及后续解析逻辑

Influence:

  1. 测试标准 VESA EDID 头部的大端模式解析
  2. 测试实机 EDID 头部的大端模式解析
  3. 验证小端模式解析不受影响

PMS: BUG-DM-DEF-001

Summary by Sourcery

Bug Fixes:

  • Accept both standard VESA and real-hardware EDID headers during big-endian validation to prevent valid display information from being rejected.

1. Root cause: big endian EDID header validation only accepts the
   standard VESA pattern "ff00ffffffff00ff", but real hardware EDID
   has 0xFF at byte 7 producing "ff00ffffffffffff" which fails the
   check and causes display info to be lost
2. Fix: add a second startsWith check for the real hardware header
   pattern alongside the standard one, so both are accepted
3. Impact: only relaxes the big endian header validation in setEdid,
   no signature change, no effect on little endian mode or parsing
   logic

Influence:
1. Test standard VESA EDID header parsing in big endian mode
2. Test real hardware EDID header parsing in big endian mode
3. Verify little endian mode parsing is unaffected

fix: 兼容实机 EDID 大端模式头部校验

1. 根因:大端模式 EDID 头部校验仅接受标准 VESA 模式
   "ff00ffffffff00ff",但实机第 7 字节为 0xFF 生成
   "ff00ffffffffffff",导致校验失败、显示器信息丢失
2. 方案:在标准头部校验旁增加实机头部模式的 startsWith 检查,
   两种头部均被接受
3. 影响:仅放宽 setEdid 大端模式头部校验,不改变函数签名,
   不影响小端模式及后续解析逻辑

Influence:
1. 测试标准 VESA EDID 头部的大端模式解析
2. 测试实机 EDID 头部的大端模式解析
3. 验证小端模式解析不受影响

PMS: BUG-DM-DEF-001
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 days and 3 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR fixes lost display information for hardware EDIDs by adding an alternate valid header prefix to the existing big-endian validation, without changing the API or parsing flow.

Flow diagram for EDID header validation

flowchart TD
    A[setEdid] --> B{Big endian mode?}
    B -->|No| C[Continue existing parsing]
    B -->|Yes| D{Header startsWith standard or hardware prefix?}
    D -->|Standard: ff00ffffffff00ff| C
    D -->|Hardware: ff00ffffffffffff| C
    D -->|Neither| E[Return false with validation error]
Loading

File-Level Changes

Change Details Files
Broaden big-endian EDID header validation to recognize both standard VESA data and the real-hardware variant.
  • Retain acceptance of the standard ff00ffffffff00ff prefix.
  • Accept the real-hardware ff00ffffffffffff prefix in setEdid.
  • Continue rejecting other big-endian headers and leave little-endian handling and subsequent parsing unchanged.
deepin-devicemanager/src/Tool/EDIDParser.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更在 EDIDParser::setEdid 大端模式分支中增加接受真实硬件 EDID 头部模式 ff00ffffffffffff,修复了合法硬件 EDID 被误判为错误的问题。变更最小化、语法正确、逻辑清晰,无安全漏洞,四维度均通过。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['建议将 EDID 头部魔法字符串提取为命名常量(如 kEdidHeaderBigEndian、kEdidHeaderBigEndianAlt),提升可读性和可维护性,但当前规模下不影响通过。']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 建议优化:提取魔法字符串为命名常量
// 在类定义或匿名命名空间中:
// static const QString kEdidHeaderBigEndian    = "ff00ffffffff00ff";
// static const QString kEdidHeaderBigEndianAlt = "ff00ffffffffffff";
//
// 修改后:
// if (!edid.startsWith(kEdidHeaderBigEndian) && !edid.startsWith(kEdidHeaderBigEndianAlt)) {
//     errorMsg = "Error edid info in big endian mode!";
//     return false;
// }

本报告由 AI 代码审查工具自动生成

@add-uos add-uos closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants