nbmont wrote:
> 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.
> 
> I know it's a little silly to be loading empty .flt files, but I can't 
> control what people try to load and *technically* it's a valid file.
> 
> Hope that's helpful -- thanks for all the wonderful work on OSG.
> 
> Nathan


bump -- did this make it to the e-mail list?

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





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

Reply via email to