PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ if() [4/10]

if ( nBytesRead >=8 &&  nBytesRead = nEntitySize - 8)

Definition at line 2001 of file shpopen.c.

2002 {
2003 /* Do a sanity check */
2004 int nSHPContentLength;
2005 memcpy( &nSHPContentLength, psSHP->pabyRec + 4, 4 );
2006 if( !bBigEndian ) SwapWord( 4, &(nSHPContentLength) );
2007 if( nSHPContentLength < 0 ||
2008 nSHPContentLength > INT_MAX / 2 - 4 ||
2009 2 * nSHPContentLength + 8 != nBytesRead )
2010 {
2011 char str[128];
2012 snprintf( str, sizeof(str),
2013 "Sanity check failed when trying to recover from inconsistent .shx/.shp with shape %d",
2014 hEntity );
2015 str[sizeof(str)-1] = '\0';
2016
2017 psSHP->sHooks.Error( str );
2018 return SHPLIB_NULLPTR;
2019 }
2020 }
#define str(s)
static int bBigEndian
Definition shpopen.c:93
static void SwapWord(int length, void *wordP)
Definition shpopen.c:110
nBytesRead
Definition shpopen.c:1993
#define SHPLIB_NULLPTR
Definition shpopen.c:101

References bBigEndian, nBytesRead, SHPLIB_NULLPTR, str, and SwapWord().

Here is the call graph for this function: