[postgis-tickets] r16864 - Fix undefined behaviour in SADFWrite
Raul
raul at rmr.ninja
Tue Oct 2 02:44:15 PDT 2018
Author: algunenano
Date: 2018-10-02 02:44:15 -0700 (Tue, 02 Oct 2018)
New Revision: 16864
Modified:
branches/2.4/NEWS
branches/2.4/loader/safileio.c
Log:
Fix undefined behaviour in SADFWrite
References #4189
Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS 2018-10-02 09:38:48 UTC (rev 16863)
+++ branches/2.4/NEWS 2018-10-02 09:44:15 UTC (rev 16864)
@@ -5,6 +5,7 @@
- #4160, Use qualified names in topology extension install (Raúl Marín)
- #4181, St_AsMVTGeom: Avoid type changes due to validation (Raúl Marín)
- #4183, St_AsMVTGeom: Drop invalid geometries after simplification (Raúl Marín)
+ - #4189, Fix undefined behaviour in SADFWrite (Raúl Marín)
PostGIS 2.4.5
Modified: branches/2.4/loader/safileio.c
===================================================================
--- branches/2.4/loader/safileio.c 2018-10-02 09:38:48 UTC (rev 16863)
+++ branches/2.4/loader/safileio.c 2018-10-02 09:44:15 UTC (rev 16864)
@@ -115,8 +115,9 @@
SAOffset SADFWrite( void *p, SAOffset size, SAOffset nmemb, SAFile file )
{
- return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb,
- (FILE *) file );
+ if (!nmemb || !p) return 0;
+ return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb,
+ (FILE *) file );
}
/************************************************************************/
More information about the postgis-tickets
mailing list