Skip to content

Conversation

@trevor-e
Copy link
Member

@trevor-e trevor-e commented Oct 31, 2025

Adds some extra breakdown of the LINKEDIT segment to match our old behavior:

Screenshot 2025-10-31 at 6 28 44 PM

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 91.02564% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.50%. Comparing base (5e8aa78) to head (ffb1ddc).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/launchpad/size/treemap/macho_element_builder.py 78.26% 1 Missing and 4 partials ⚠️
src/launchpad/parsers/apple/macho_parser.py 93.10% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #451      +/-   ##
==========================================
+ Coverage   80.46%   80.50%   +0.03%     
==========================================
  Files         159      159              
  Lines       13410    13462      +52     
  Branches     1414     1424      +10     
==========================================
+ Hits        10790    10837      +47     
  Misses       2086     2086              
- Partials      534      539       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trevor-e trevor-e marked this pull request as ready for review October 31, 2025 22:31
Comment on lines 333 to 336
if self.binary.has_code_signature:
cs = self.binary.code_signature
code_signature_size = cs.data_size
code_signature_offset = cs.data_offset
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: AttributeError occurs if self.binary.code_signature is None despite has_code_signature being True when accessing cs.data_size.
Severity: CRITICAL | Confidence: 0.95

🔍 Detailed Analysis

The code attempts to access cs.data_size on line 335 without ensuring cs is not None. This occurs when self.binary.has_code_signature is True but self.binary.code_signature returns None, leading to an AttributeError: 'NoneType' object has no attribute 'data_size'. This can happen if the LIEF library returns None for code_signature under certain conditions, such as with malformed binaries, causing an unexpected AttributeError that will propagate up.

💡 Suggested Fix

Add a null check for self.binary.code_signature after the has_code_signature check. Modify if self.binary.has_code_signature: to if self.binary.has_code_signature and self.binary.code_signature:.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/launchpad/parsers/apple/macho_parser.py#L333-L336

Potential issue: The code attempts to access `cs.data_size` on line 335 without ensuring
`cs` is not `None`. This occurs when `self.binary.has_code_signature` is `True` but
`self.binary.code_signature` returns `None`, leading to an `AttributeError: 'NoneType'
object has no attribute 'data_size'`. This can happen if the LIEF library returns `None`
for `code_signature` under certain conditions, such as with malformed binaries, causing
an unexpected `AttributeError` that will propagate up.

Did we get this right? 👍 / 👎 to inform future reviews.

@trevor-e trevor-e merged commit 73f2fd3 into main Nov 3, 2025
21 checks passed
@trevor-e trevor-e deleted the telkins/code-signature branch November 3, 2025 15:26
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.

3 participants