overflow.
pull/1290/head
Kim Kulling 2017-05-31 21:43:41 +02:00
parent 8c6f18ea2a
commit 9e98097aae
2 changed files with 10 additions and 17 deletions

View File

@ -289,7 +289,6 @@ size_t ObjFileParser::getNumComponentsInDataDefinition() {
const char* tmp( &m_DataIt[0] ); const char* tmp( &m_DataIt[0] );
bool end_of_definition = false; bool end_of_definition = false;
while ( !end_of_definition ) { while ( !end_of_definition ) {
//while( !IsLineEnd( *tmp ) ) {
if ( isDataDefinitionEnd( tmp ) ) { if ( isDataDefinitionEnd( tmp ) ) {
tmp += 2; tmp += 2;
} else if ( IsLineEnd( *tmp ) ) { } else if ( IsLineEnd( *tmp ) ) {
@ -420,10 +419,6 @@ static const std::string DefaultObjName = "defaultobject";
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Get values for a new face instance // Get values for a new face instance
void ObjFileParser::getFace( aiPrimitiveType type ) { void ObjFileParser::getFace( aiPrimitiveType type ) {
//copyNextLine(m_buffer, Buffersize);
//char *pPtr = m_DataIt;
//char *pPtr = m_buffer;
//char *pEnd = &pPtr[Buffersize];
m_DataIt = getNextToken<DataArrayIt>( m_DataIt, m_DataItEnd ); m_DataIt = getNextToken<DataArrayIt>( m_DataIt, m_DataItEnd );
if ( m_DataIt == m_DataItEnd || *m_DataIt == '\0' ) { if ( m_DataIt == m_DataItEnd || *m_DataIt == '\0' ) {
return; return;
@ -595,15 +590,6 @@ void ObjFileParser::getMaterialDesc() {
// Get a comment, values will be skipped // Get a comment, values will be skipped
void ObjFileParser::getComment() { void ObjFileParser::getComment() {
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine ); m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
/* while (m_DataIt != m_DataItEnd) {
if ( '\n' == (*m_DataIt)) {
++m_DataIt;
break;
} else {
++m_DataIt;
}
}*/
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -1,3 +1,5 @@
#pragma once
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project. // This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
@ -22,6 +24,7 @@
#include <assimp/defs.h> #include <assimp/defs.h>
#include "StringComparison.h" #include "StringComparison.h"
#include <assimp/DefaultLogger.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
@ -192,7 +195,7 @@ inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int*
uint64_t value = 0; uint64_t value = 0;
if ( *in < '0' || *in > '9' ) if ( *in < '0' || *in > '9' )
throw std::invalid_argument(std::string("The string \"") + in + "\" cannot be converted into a value."); throw std::invalid_argument(std::string("The string \"") + in + "\" cannot be converted into a value.");
bool running = true; bool running = true;
while ( running ) while ( running )
@ -202,8 +205,12 @@ inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int*
const uint64_t new_value = ( value * 10 ) + ( *in - '0' ); const uint64_t new_value = ( value * 10 ) + ( *in - '0' );
if (new_value < value) /* numeric overflow, we rely on you */ // numeric overflow, we rely on you
throw std::overflow_error(std::string("Converting the string \"") + in + "\" into a value resulted in overflow."); if ( new_value < value ) {
DefaultLogger::get()->warn( std::string( "Converting the string \"" ) + in + "\" into a value resulted in overflow." );
return 0;
}
//throw std::overflow_error();
value = new_value; value = new_value;