Hi,

Saw this in vs2010 when I tried to load an .flt file freshly made in creator 
but with nothing in it.  You get a string index out of range exception in 
PaletterRecords.cpp, line 73 where it does

        uint32 paletteSize = in.readUInt32();

        // Entries in vertex pool found by offset from start of this record.
        const int RECORD_HEADER_SIZE = 4;
        const int OFFSET = RECORD_HEADER_SIZE+sizeof(paletteSize);

        std::string buffer(paletteSize,'\0');
        in.read(&buffer[OFFSET], paletteSize-OFFSET);

The problem is that for an empty vertex palette, OFFSET equals paletteSize, so 
OFFSET is past the end of buffer.  This code normally doesn't have a problem 
because it's reading 0 bytes into this location anyway, but iterator debugging 
catches the out of range index.

A simple if (OFFSET < buffer.size()) fixes the problem.  I attached an amended 
file with the fix, plus a test model that reproduces the problem.

Hope that's helpful -- thanks for all the wonderful work on OSG.

Nathan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46195#46195




Attachments: 
http://forum.openscenegraph.org//files/paletterecords_187.cpp
http://forum.openscenegraph.org//files/emptyflt_164.txt


_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to