Skip to content

Fix crash caused by spurious aliases phandles. #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dtschema/dtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def prop_value(validator, nodename, p):
data = bytes(p)
fmt = None

if nodename in {'__fixups__', 'aliases'}:
if nodename in {'__fixups__'}:
Copy link
Member

Choose a reason for hiding this comment

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

This is going to result in aliases property names possibly matching on some actual property name and getting the type wrong. You need to add an exclusion for 'phandle' (and perhaps 'linux,phandle' for completeness).

Copy link
Author

Choose a reason for hiding this comment

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

I suppose that it might then be easier to preserve the special case for 'aliases' and to test p.name for 'phandle', decoding the numeric data obtained for that property. This would cover the case of a phandle having been introduced without risking other breakage.

return data[:-1].decode(encoding='ascii').split('\0')

prop_types = set(validator.property_get_type(p.name))
Expand Down