cargilld    2004/12/20 07:50:42

  Modified:    c/src/xercesc/internal XMLReader.cpp
  Log:
  Add assert to avoid memory violation.
  
  Revision  Changes    Path
  1.26      +9 -3      xml-xerces/c/src/xercesc/internal/XMLReader.cpp
  
  Index: XMLReader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- XMLReader.cpp     29 Sep 2004 00:24:01 -0000      1.25
  +++ XMLReader.cpp     20 Dec 2004 15:50:42 -0000      1.26
  @@ -597,6 +597,9 @@
       if (!token)
       {
           if (fXMLVersion == XMLV1_1 && ((fCharBuf[fCharIndex] >= 0xD800) && 
(fCharBuf[fCharIndex] <= 0xDB7F))) {
  +           // make sure one more char is in the buffer, the transcoder
  +           // should put only a complete surrogate pair into the buffer
  +           assert(fCharIndex+1 < fCharsAvail);
              if ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] 
> 0xDFFF))
                  return false;
   
  @@ -626,8 +629,11 @@
               //  Check the current char and take it if its a name char. Else
               //  break out.
               if (fXMLVersion == XMLV1_1 && ((fCharBuf[fCharIndex] >= 0xD800) 
&& (fCharBuf[fCharIndex] <= 0xDB7F))) {
  -               if ((fCharBuf[fCharIndex+1] < 0xDC00) || 
(fCharBuf[fCharIndex+1] > 0xDFFF))
  -                   return !toFill.isEmpty();
  +                // make sure one more char is in the buffer, the transcoder
  +                // should put only a complete surrogate pair into the buffer
  +                assert(fCharIndex+1 < fCharsAvail);
  +                if ((fCharBuf[fCharIndex+1] < 0xDC00) || 
(fCharBuf[fCharIndex+1] > 0xDFFF))
  +                    return !toFill.isEmpty();
   
                   toFill.append(fCharBuf[fCharIndex++]);
                   fCurCol++;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to