Skip to content

Commit 44f7cce

Browse files
committed
fixes remaining GDAL version vulnerability
1 parent 5b19d2b commit 44f7cce

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

R/crs.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ make_crs = function(x) {
167167
x = if (is.null(comment(x)) || (CPL_proj_version() < "6.0.0" ||
168168
CPL_gdal_version() < "3.0.0"))
169169

170-
comment(x) # WKT2
171-
else
172170
x@projargs
171+
else
172+
comment(x) # WKT2
173173
}
174174
if (is.numeric(x) && !is.na(x))
175175
x = paste0("EPSG:", x)

R/sp.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ CRS_from_crs = function(from) {
330330
sp::CRS(NA_character_)
331331
else
332332
sp::CRS(from$proj4string)
333-
if (CPL_proj_version() < "6.0.0" ||
334-
CPL_gdal_version() < "3.0.0") {
333+
if (CPL_proj_version() >= "6.0.0" &&
334+
CPL_gdal_version() >= "3.0.0") {
335335
if (!is.null(from$wkt) && !is.na(from$wkt))
336-
comment(ret) = sp::CRS(SRS_string=from$wkt)
336+
comment(ret) = comment(sp::CRS(SRS_string=from$wkt))
337337
}
338338
ret
339339
}

tests/crs.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ if (sf_extSoftVersion()["USE_PROJ_H"] == "true" || sf_proj_info("have_datum_file
4141
"datum files not installed"
4242
}
4343

44-
x = st_crs(sp::CRS("+proj=longlat +ellps=WGS84 +no_defs"))
44+
x0 = sp::CRS(SRS_string="EPSG:4326")
45+
cat(sp::wkt(x0), "\n")
46+
x = st_crs(x0)
47+
x
48+
49+
y0 = st_crs(4326)
50+
y0
51+
y = as(y0, "CRS")
52+
cat(sp::wkt(y), "\n")
4553

4654
# https://github.com/r-spatial/sf/issues/1170
4755
g = st_as_sfc("POLYGON ((-61.66957 10.69214, -61.565 10.75728, -61.37453 10.77654, -61.40721 10.60681, -61.66957 10.69214))")

0 commit comments

Comments
 (0)