Skip to content

Commit

Permalink
fromSceneE57File: check for too many points
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedr committed Sep 2, 2024
1 parent 7feddb8 commit f9b24b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/MRMesh/MRPointsLoadE57.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "MRQuaternion.h"
#include "MRTimer.h"
#include <MRPch/MRFmt.h>
#include <climits>

#pragma warning(push)
#pragma warning(disable: 4251) // class needs to have dll-interface to be used by clients of another class
Expand Down Expand Up @@ -84,6 +85,9 @@ Expected<std::vector<NamedCloud>> fromSceneE57File( const std::filesystem::path&
if ( !eReader.GetData3DSizes( scanIndex, nRow, nColumn, nPointsSize, nGroupsSize, nCountSize, bColumnIndex) )
return MR::unexpected( std::string( "GetData3DSizes failed during reading of " + utf8string( file ) ) );

if ( nPointsSize > INT_MAX )
return MR::unexpected( fmt::format( "Too many points {} in {}.\nMaximum supported is {}.", nPointsSize, utf8string( file ), INT_MAX ) );

// how many points to read in a time
const int64_t nSize = std::min( nPointsSize, int64_t( 1024 ) * 128 );

Expand Down

0 comments on commit f9b24b4

Please sign in to comment.