Fix dereferencing null pointer
authorHokwon Song <hokwon.song@samsung.com>
Fri, 5 Apr 2013 02:24:08 +0000 (11:24 +0900)
committerHokwon Song <hokwon.song@samsung.com>
Fri, 5 Apr 2013 08:55:45 +0000 (17:55 +0900)
Change-Id: I397ec6549590d1d4943417356577e8b03ea1d292
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
src/text/FText_GsmEncodingCore.cpp

index 7805c16..fb2ebda 100644 (file)
@@ -290,7 +290,7 @@ wchar_t*
 _GsmEncodingCore::DecodeN(const byte* pSrc, int srcLength, int& retLength)
 {
        // 0 in GSM is mapped to 0x40 ['@'] in UNICODE, following code is to handle terminating null.
-       if (srcLength > 1 && pSrc && pSrc[srcLength - 1] == '\0')
+       if (srcLength > 1 && pSrc[srcLength - 1] == '\0')
        {
                --srcLength;
        }
@@ -304,7 +304,7 @@ _GsmEncodingCore::DecodeN(const byte* pSrc, int srcLength, int& retLength)
        byte* pGsmByte = (byte*) pSrc;
        wchar_t* pCurrPos = pDst.get();
        int index = 0;
-       while (srcLength > 0)
+       while (srcLength > 0 && pGsmByte != null)
        {
                *pCurrPos = GSM_UNICODE_TABLE[*pGsmByte];
                if (*pGsmByte == 0x001B)