freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] int-not32-changes-2017 c122d31 13/25: To make large unsigned


From: suzuki toshiya
Subject: [freetype2] int-not32-changes-2017 c122d31 13/25: To make large unsigned 16bit value, temporal bit shift like (1 << 16) can induce an overflow.
Date: Wed, 13 Sep 2017 04:15:05 -0400 (EDT)

branch: int-not32-changes-2017
commit c122d3172c1906e1aec71afd34c2847e59625048
Author: suzuki toshiya <address@hidden>
Commit: suzuki toshiya <address@hidden>

    To make large unsigned 16bit value, temporal bit shift like (1 << 16) can 
induce an overflow.
    Change to make 32bit value by bitshifting and cast to 16bit in later.
---
 src/pfr/pfrload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c
index 4f84165..53ce625 100644
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -305,7 +305,7 @@
     /* - we need at least 18 bytes for a log font record */
     /* - the overall size is at least 95 bytes plus the  */
     /*   log header and log font records                 */
-    if ( count > ( ( 1 << 16 ) - 2 ) / 5                ||
+    if ( count > (FT_UInt)(( 1L << 16 ) - 2 ) / 5       ||
          2 + count * 5 >= stream->size - section_offset ||
          95 + count * ( 5 + 18 ) >= stream->size        )
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]