]> granicus.if.org Git - icu/commitdiff
ICU-9340 Use bit mask instead of cast to avoid buffer overflow
authorMichael Ow <mow@svn.icu-project.org>
Wed, 13 Jun 2012 21:07:53 +0000 (21:07 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Wed, 13 Jun 2012 21:07:53 +0000 (21:07 +0000)
X-SVN-Rev: 31948

icu4c/source/common/ucnvisci.c

index 055a0a497c95b23c09c055a102025e3da2a5fea0..b36894849cf17665e8591ca745339b44fc6cef41 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 2000-2011, International Business Machines
+*   Copyright (C) 2000-2012, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   file name:  ucnvisci.c
@@ -1140,7 +1140,7 @@ static const uint16_t lookupTable[][2]={
     targetUniChar = toUnicodeTable[(sourceChar)] ;                                       \
     /* is the code point valid in current script? */                                     \
     if(sourceChar> ASCII_END &&                                                          \
-            (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode)==0){    \
+            (validityTable[(targetUniChar & 0x00FF)] & data->currentMaskToUnicode)==0){    \
         /* Vocallic RR is assigne in ISCII Telugu and Unicode */                         \
         if(data->currentDeltaToUnicode!=(TELUGU_DELTA) ||                                \
                     targetUniChar!=VOCALLIC_RR){                                         \