Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Pillow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
Pillow
Commits
0cee2f24c375
Commit
0cee2f24c375
authored
11 years ago
by
wiredfool
Browse files
Options
Downloads
Patches
Plain Diff
Icns DOS fix -- CVE-2014-3589
Found and reported by Andrew Drake of dropbox.com
parent
0221b8f21fac
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
PIL/IcnsImagePlugin.py
+2
-0
2 additions, 0 deletions
PIL/IcnsImagePlugin.py
Tests/check_icns_dos.py
+10
-0
10 additions, 0 deletions
Tests/check_icns_dos.py
with
12 additions
and
0 deletions
PIL/IcnsImagePlugin.py
+
2
−
0
View file @
0cee2f24
...
@@ -120,6 +120,8 @@
...
@@ -120,6 +120,8 @@
i
=
HEADERSIZE
i
=
HEADERSIZE
while
i
<
filesize
:
while
i
<
filesize
:
sig
,
blocksize
=
nextheader
(
fobj
)
sig
,
blocksize
=
nextheader
(
fobj
)
if
blocksize
<=
0
:
raise
SyntaxError
(
'
invalid block header
'
)
i
=
i
+
HEADERSIZE
i
=
i
+
HEADERSIZE
blocksize
=
blocksize
-
HEADERSIZE
blocksize
=
blocksize
-
HEADERSIZE
dct
[
sig
]
=
(
i
,
blocksize
)
dct
[
sig
]
=
(
i
,
blocksize
)
...
...
This diff is collapsed.
Click to expand it.
Tests/check_icns_dos.py
0 → 100644
+
10
−
0
View file @
0cee2f24
# Tests potential DOS of IcnsImagePlugin with 0 length block.
# Run from anywhere that PIL is importable.
from
PIL
import
Image
from
io
import
BytesIO
if
bytes
is
str
:
Image
.
open
(
BytesIO
(
bytes
(
'
icns
\x00\x00\x00\x10
hang
\x00\x00\x00\x00
'
)))
else
:
Image
.
open
(
BytesIO
(
bytes
(
'
icns
\x00\x00\x00\x10
hang
\x00\x00\x00\x00
'
,
'
latin-1
'
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment