[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 59828f7 1/5: [pfr] Various clang sanitizer fixes.
From: |
Werner LEMBERG |
Subject: |
[freetype2] master 59828f7 1/5: [pfr] Various clang sanitizer fixes. |
Date: |
Sat, 26 Mar 2016 21:42:35 +0000 |
branch: master
commit 59828f72a2f988abcc15873e5b3091295a783257
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[pfr] Various clang sanitizer fixes.
* src/pfr/pfrsbit.c (pfr_load_bitmap_metrics): Correctly handle
signed nibbles.
(pfr_slot_load_bitmap): Correctly exit frame in case of error.
Fix invalid left shifts.
---
ChangeLog | 9 +++++++++
src/pfr/pfrsbit.c | 16 +++++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bbdadea..9c05d3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-03-25 Werner Lemberg <address@hidden>
+
+ [pfr] Various clang sanitizer fixes.
+
+ * src/pfr/pfrsbit.c (pfr_load_bitmap_metrics): Correctly handle
+ signed nibbles.
+ (pfr_slot_load_bitmap): Correctly exit frame in case of error.
+ Fix invalid left shifts.
+
2016-03-23 Werner Lemberg <address@hidden>
Rename `VERSION.DLL' (#47472).
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 22f6096..8ec31ac 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -357,7 +357,6 @@
{
FT_Error error = FT_Err_Ok;
FT_Byte flags;
- FT_Char c;
FT_Byte b;
FT_Byte* p = *pdata;
FT_Long xpos, ypos, advance;
@@ -377,9 +376,9 @@
{
case 0:
PFR_CHECK( 1 );
- c = PFR_NEXT_INT8( p );
- xpos = c >> 4;
- ypos = ( (FT_Char)( c << 4 ) ) >> 4;
+ b = PFR_NEXT_BYTE( p );
+ xpos = (FT_Char)b >> 4;
+ ypos = ( (FT_Char)( b << 4 ) ) >> 4;
break;
case 1:
@@ -630,6 +629,8 @@
&xpos, &ypos,
&xsize, &ysize,
&advance, &format );
+ if ( error )
+ goto Exit1;
/*
* Before allocating the target bitmap, we check whether the given
@@ -675,7 +676,7 @@
{
if ( FT_ERR_EQ( error, Invalid_Table ) )
FT_ERROR(( "pfr_slot_load_bitmap: invalid bitmap dimensions\n" ));
- goto Exit;
+ goto Exit1;
}
/*
@@ -710,8 +711,8 @@
/* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */
glyph->root.metrics.width = (FT_Pos)xsize << 6;
glyph->root.metrics.height = (FT_Pos)ysize << 6;
- glyph->root.metrics.horiBearingX = xpos << 6;
- glyph->root.metrics.horiBearingY = ypos << 6;
+ glyph->root.metrics.horiBearingX = xpos * 64;
+ glyph->root.metrics.horiBearingY = ypos * 64;
glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) );
glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
glyph->root.metrics.vertBearingY = 0;
@@ -737,6 +738,7 @@
}
}
+ Exit1:
FT_FRAME_EXIT();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 59828f7 1/5: [pfr] Various clang sanitizer fixes.,
Werner LEMBERG <=