xerces-c-3.0.1/2.7.0 can not deal with high GBK file

There is a bug inside util/Transcoders/IconvGNU/IconvGNUTransService.cpp.

1027     for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
1028         size_t    rc = iconvFrom(startSrc, &srcLen, &orgTarget,
uChSize());
1029         if (rc == (size_t)-1) {
1030             if (errno != E2BIG || prevSrcLen == srcLen) {
1031                 ThrowXMLwithMemMgr(TranscodingException,
XMLExcepts::Trans_BadSrcSeq, getMemoryManager());
1032             }
1033         }
1034         charSizes[cnt] = prevSrcLen - srcLen;
1035         prevSrcLen = srcLen;
1036         bytesEaten += charSizes[cnt];
1037         startSrc = endSrc - srcLen;
1038         toReturn++;
1039     }

If a huge file is passed to xerces, partial text will be passed to
IconvGNUTranscoder, and an incomplete multibyte sequence will been
encountered in the input.
errno EINVAL is for that. But the errno of EINVAL is unchecked.



Regards,
   Kirby Zhou    
   from   SOHU-RD   +86-10-6272-8261



_______________________________________________
epel-devel-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/epel-devel-list

Reply via email to