PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ if() [4/10]

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

Definition at line 1992 of file shpopen.c.

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

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

Here is the call graph for this function: