You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Daniel Burr (JIRA)" <xe...@xml.apache.org> on 2006/06/30 06:50:31 UTC

[jira] Created: (XERCESC-1612) Out of bounds read in XMLUTF8Transcoder::transcodeFrom

Out of bounds read in XMLUTF8Transcoder::transcodeFrom
------------------------------------------------------

         Key: XERCESC-1612
         URL: http://issues.apache.org/jira/browse/XERCESC-1612
     Project: Xerces-C++
        Type: Bug

  Components: Miscellaneous  
    Versions: 2.7.0    
    Reporter: Daniel Burr
    Priority: Trivial


The test for character conversion is:
while (*srcPtr <= 127 && srcPtr != srcEnd && outPtr != outEnd );

This can give an error in valgrind because srcPtr is being dereferenced before the check is done to see if it is at the end.  The error can be fixed with something like:
while (srcPtr != srcEnd && *srcPtr <= 127 && outPtr != outEnd );

--- XMLUTF8Transcoder.cpp.orig  2006-06-30 14:28:35.000000000 +1000
+++ XMLUTF8Transcoder.cpp       2006-06-30 14:28:39.000000000 +1000
@@ -154,8 +154,8 @@
             do
             {
                 *outPtr++ = XMLCh(*srcPtr++);
-            } while (*srcPtr <= 127    &&
-                      srcPtr != srcEnd &&
+            } while ( srcPtr != srcEnd &&
+                     *srcPtr <= 127    &&
                       outPtr != outEnd );
             memset(sizePtr,1,srcPtr - srcPtr_save);
             sizePtr += srcPtr - srcPtr_save;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Resolved: (XERCESC-1612) Out of bounds read in XMLUTF8Transcoder::transcodeFrom

Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESC-1612?page=all ]
     
David Bertoni resolved XERCESC-1612:
------------------------------------

    Fix Version: Nightly build (please specify the date)
     Resolution: Duplicate

This is a duplicate of XERCESC-1555.

> Out of bounds read in XMLUTF8Transcoder::transcodeFrom
> ------------------------------------------------------
>
>          Key: XERCESC-1612
>          URL: http://issues.apache.org/jira/browse/XERCESC-1612
>      Project: Xerces-C++
>         Type: Bug

>   Components: Miscellaneous
>     Versions: 2.7.0
>     Reporter: Daniel Burr
>     Priority: Trivial
>      Fix For: Nightly build (please specify the date)

>
> The test for character conversion is:
> while (*srcPtr <= 127 && srcPtr != srcEnd && outPtr != outEnd );
> This can give an error in valgrind because srcPtr is being dereferenced before the check is done to see if it is at the end.  The error can be fixed with something like:
> while (srcPtr != srcEnd && *srcPtr <= 127 && outPtr != outEnd );
> --- XMLUTF8Transcoder.cpp.orig  2006-06-30 14:28:35.000000000 +1000
> +++ XMLUTF8Transcoder.cpp       2006-06-30 14:28:39.000000000 +1000
> @@ -154,8 +154,8 @@
>              do
>              {
>                  *outPtr++ = XMLCh(*srcPtr++);
> -            } while (*srcPtr <= 127    &&
> -                      srcPtr != srcEnd &&
> +            } while ( srcPtr != srcEnd &&
> +                     *srcPtr <= 127    &&
>                        outPtr != outEnd );
>              memset(sizePtr,1,srcPtr - srcPtr_save);
>              sizePtr += srcPtr - srcPtr_save;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org