PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ if() [4/10]

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

Definition at line 1990 of file shpopen.c.

1991  {
1992  /* Do a sanity check */
1993  int nSHPContentLength;
1994  memcpy( &nSHPContentLength, psSHP->pabyRec + 4, 4 );
1995  if( !bBigEndian ) SwapWord( 4, &(nSHPContentLength) );
1996  if( nSHPContentLength < 0 ||
1997  nSHPContentLength > INT_MAX / 2 - 4 ||
1998  2 * nSHPContentLength + 8 != nBytesRead )
1999  {
2000  char str[128];
2001  snprintf( str, sizeof(str),
2002  "Sanity check failed when trying to recover from inconsistent .shx/.shp with shape %d",
2003  hEntity );
2004  str[sizeof(str)-1] = '\0';
2005 
2006  psSHP->sHooks.Error( str );
2007  return SHPLIB_NULLPTR;
2008  }
2009  }
#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:1982
#define SHPLIB_NULLPTR
Definition: shpopen.c:101

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

Here is the call graph for this function: