Fix potential reading/writing 1 byte behind it's own buffer in PLY loader.

Thanks @wolfgang for report and patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52627&p=305573#p305573)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6113 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-06-10 21:21:57 +00:00
parent 2d67c2d92c
commit 49b39e456d
2 changed files with 4 additions and 2 deletions

@ -1,5 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Fix potential reading/writing 1 byte behind it's own buffer in PLY loader.
Thanks @wolfgang for report and patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52627&p=305573#p305573)
- ICursorControl::isVisible is now always returning the flag set in setVisible.
This changes the behaviour on Win32 somewhat when Windows returned a CURSOR_SUPPRESSED state (touch-screen input).
Previously we set IsVisible it to false when CURSOR_SUPPRESSED was set.

@ -572,7 +572,7 @@ c8* CPLYMeshFileLoader::getNextLine()
StartPointer = LineEndPointer + 1;
// crlf split across buffer move
if (*StartPointer == '\n')
if (StartPointer<EndPointer && *StartPointer == '\n')
{
*StartPointer = '\0';
++StartPointer;
@ -583,7 +583,7 @@ c8* CPLYMeshFileLoader::getNextLine()
while (pos < EndPointer && *pos && *pos != '\r' && *pos != '\n')
++pos;
if ( pos < EndPointer && ( *(pos+1) == '\r' || *(pos+1) == '\n') )
if ( (pos+1) < EndPointer && ( *(pos+1) == '\r' || *(pos+1) == '\n') )
{
*pos = '\0';
++pos;