Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GIMP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2,642
Issues
2,642
List
Boards
Labels
Service Desk
Milestones
Merge Requests
36
Merge Requests
36
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
GIMP
Commits
869dcd7b
Commit
869dcd7b
authored
Dec 04, 2009
by
Nils Philippsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GBR: sanitize input data
Guard against bogus zero width, height, bytes and allocation overflows.
parent
a9671395
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
plug-ins/common/file-gbr.c
plug-ins/common/file-gbr.c
+13
-1
No files found.
plug-ins/common/file-gbr.c
View file @
869dcd7b
...
...
@@ -350,7 +350,7 @@ load_image (const gchar *filename,
gint
bn_size
;
GimpImageBaseType
base_type
;
GimpImageType
image_type
;
gs
size
size
;
gs
ize
size
;
fd
=
g_open
(
filename
,
O_RDONLY
|
_O_BINARY
,
0
);
...
...
@@ -380,6 +380,18 @@ load_image (const gchar *filename,
bh
.
magic_number
=
g_ntohl
(
bh
.
magic_number
);
bh
.
spacing
=
g_ntohl
(
bh
.
spacing
);
/* Sanitize values */
if
((
bh
.
width
==
0
)
||
(
bh
.
height
==
0
)
||
(
bh
.
bytes
==
0
)
||
(
G_MAXSIZE
/
bh
.
width
/
bh
.
height
/
bh
.
bytes
<
1
))
{
g_set_error
(
error
,
G_FILE_ERROR
,
G_FILE_ERROR_FAILED
,
_
(
"Invalid header data in '%s': width=%lu, height=%lu, "
"bytes=%lu"
),
gimp_filename_to_utf8
(
filename
),
(
unsigned
long
int
)
bh
.
width
,
(
unsigned
long
int
)
bh
.
height
,
(
unsigned
long
int
)
bh
.
bytes
);
return
-
1
;
}
switch
(
bh
.
version
)
{
case
1
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment