Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vincent Wei
harfbuzz
Commits
48bc3039
Commit
48bc3039
authored
6 years ago
by
Behdad Esfahbod
Browse files
Options
Download
Email Patches
Plain Diff
[sbix] Check blob length against PNG header leangth
parent
d3ec31a5
master
arabic-table-x
bot-check
coverity_scan
decltype
inttype-constructors
iter
metrics
test-str-literal-constness
typename-outside-template
var-subset
2.3.1
2.3.0
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hb-ot-color-sbix-table.hh
+23
-14
src/hb-ot-color-sbix-table.hh
with
23 additions
and
14 deletions
+23
-14
src/hb-ot-color-sbix-table.hh
View file @
48bc3039
...
...
@@ -199,14 +199,24 @@ struct sbix
struct
PNGHeader
{
HBUINT8
signature
[
8
];
HBUINT8
chunkHeaderIHDR
[
8
];
HBUINT32
width
;
HBUINT32
height
;
HBUINT8
bitDepth
;
HBUINT8
colorType
;
HBUINT8
compressionMethod
;
HBUINT8
filterMethod
;
HBUINT8
interlaceMethod
;
struct
{
struct
{
HBUINT32
length
;
Tag
type
;
}
header
;
HBUINT32
width
;
HBUINT32
height
;
HBUINT8
bitDepth
;
HBUINT8
colorType
;
HBUINT8
compressionMethod
;
HBUINT8
filterMethod
;
HBUINT8
interlaceMethod
;
}
IHDR
;
public:
DEFINE_SIZE_STATIC
(
29
);
};
inline
bool
get_png_extents
(
hb_codepoint_t
glyph
,
...
...
@@ -222,21 +232,20 @@ struct sbix
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
&
x_offset
,
&
y_offset
);
const
PNGHeader
&
header
=
*
blob
->
as
<
PNGHeader
>
();
if
(
header
.
width
==
0
&&
header
.
width
==
0
)
const
PNGHeader
&
png
=
*
blob
->
as
<
PNGHeader
>
();
if
(
unlikely
(
blob
->
length
<
sizeof
(
PNGHeader
))
)
return
false
;
extents
->
x_bearing
=
x_offset
;
extents
->
y_bearing
=
y_offset
;
extents
->
width
=
header
.
width
;
extents
->
height
=
header
.
height
;
extents
->
width
=
png
.
IHDR
.
width
;
extents
->
height
=
png
.
IHDR
.
height
;
hb_blob_destroy
(
blob
);
return
true
;
}
inline
bool
has_data
()
const
{
return
sbix_len
;
}
inline
bool
has_data
()
const
{
return
sbix_len
;
}
private:
hb_blob_t
*
sbix_blob
;
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help