Skip to content

Detect mislabelled icon files via their file header. - #6870

Merged
bwoodsend merged 2 commits into
pyinstaller:developfrom
bwoodsend:icon-mime
Jun 5, 2022
Merged

bwoodsend merged 2 commits into
pyinstaller:developfrom
bwoodsend:icon-mime

Conversation

@bwoodsend

Copy link
Copy Markdown
Member

In addition to checking an icon's suffix to see if it is of the correct native type, check the first few bytes of the icon to guard against a naive user just renaming a .png to a .ico or .icns.

I'm not entirely sure why I'm bothering with this. It might have shortened #6845's long path to nowhere.

In addition to checking an icon's suffix to see if it is of the correct native
type, check the first few bytes of the icon to guard against a naive user just
renaming a .png to a .ico or .icns.
@bwoodsend
bwoodsend marked this pull request as ready for review June 5, 2022 12:24
@bwoodsend
bwoodsend requested a review from rokm June 5, 2022 12:24
Comment thread tests/unit/test_normalize_icon_type.py Resolved
@rokm

rokm commented Jun 5, 2022

Copy link
Copy Markdown
Member

Hmmm, the absence of any case normalization of the extension in normalize_icon_type is probably a problem, but it is not strictly this PR's problem. (I.e., if we passed a legit .ico with .ICO suffix, we'll probably end up converting it to .ico if pillow is available or raise an error otherwise)

@bwoodsend
bwoodsend merged commit 2df8314 into pyinstaller:develop Jun 5, 2022
@bwoodsend
bwoodsend deleted the icon-mime branch June 5, 2022 19:59
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants