Skip to content

Commit

Permalink
Merge pull request OSGeo#7014 from rouault/deflate64
Browse files Browse the repository at this point in the history
/vsizip/: add read support for Deflate64 (fixes OSGeo#7013)
  • Loading branch information
a0x8o committed Jan 5, 2023
1 parent 370272e commit b0d6bab
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 33 deletions.
23 changes: 15 additions & 8 deletions autotest/gdrivers/jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,27 +583,34 @@ def test_jpeg_17():
gdal.ErrorReset()
ds = gdal.Open("data/jpeg/byte_corrupted2.jpg")
with gdaltest.error_handler("CPLQuietErrorHandler"):
# Get this warning:
# Get this error:
# libjpeg: Corrupt JPEG data: found marker 0x00 instead of RST63
ds.GetRasterBand(1).Checksum()
assert ds.GetRasterBand(1).Checksum() < 0

assert not (
gdal.GetLastErrorType() != gdal.CE_Warning or gdal.GetLastErrorMsg() == ""
gdal.GetLastErrorType() != gdal.CE_Failure or gdal.GetLastErrorMsg() == ""
)

gdal.ErrorReset()
ds = gdal.Open("data/jpeg/byte_corrupted2.jpg")
with gdaltest.error_handler("CPLQuietErrorHandler"):
gdal.SetConfigOption("GDAL_ERROR_ON_LIBJPEG_WARNING", "TRUE")
# Get this ERROR 1:
# libjpeg: Corrupt JPEG data: found marker 0x00 instead of RST63
ds.GetRasterBand(1).Checksum()
gdal.SetConfigOption("GDAL_ERROR_ON_LIBJPEG_WARNING", None)
with gdaltest.config_option("GDAL_ERROR_ON_LIBJPEG_WARNING", "TRUE"):
assert ds.GetRasterBand(1).Checksum() < 0

assert not (
gdal.GetLastErrorType() != gdal.CE_Failure or gdal.GetLastErrorMsg() == ""
)

gdal.ErrorReset()
ds = gdal.Open("data/jpeg/byte_corrupted2.jpg")
with gdaltest.error_handler("CPLQuietErrorHandler"):
with gdaltest.config_option("GDAL_ERROR_ON_LIBJPEG_WARNING", "FALSE"):
assert ds.GetRasterBand(1).Checksum() != 0

assert not (
gdal.GetLastErrorType() != gdal.CE_Warning or gdal.GetLastErrorMsg() == ""
)


###############################################################################
# Test situation where we cause a restart and need to reset scale
Expand Down
24 changes: 24 additions & 0 deletions autotest/pyscripts/data/test_latin1_é.vrt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<VRTDataset rasterXSize="504" rasterYSize="454">
<SRS>PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]</SRS>
<GeoTransform> 6.3490506599999999e+05, 4.7627007652033447e-02, 0.0000000000000000e+00, 8.1392822900000000e+06, 0.0000000000000000e+00, -4.7657934423650940e-02</GeoTransform>
<Metadata>
<MDI key="AREA_OR_POINT">Area</MDI>
<MDI key="TIFFTAG_SOFTWARE">pix4dmapper</MDI>
</Metadata>
<VRTRasterBand dataType="Byte" band="1">
<NoDataValue>-10000</NoDataValue>
<ColorInterp>Red</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="2">
<NoDataValue>-10000</NoDataValue>
<ColorInterp>Green</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="3">
<NoDataValue>-10000</NoDataValue>
<ColorInterp>Blue</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="4">
<NoDataValue>-10000</NoDataValue>
<ColorInterp>Alpha</ColorInterp>
</VRTRasterBand>
</VRTDataset>
Binary file added doc/images/logo-kartoza.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/source/about_no_title.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.. include:: ./substitutions.rst

GDAL is a translator library for raster and vector geospatial data formats that is released under an MIT style Open Source :ref:`license` by the `Open Source Geospatial Foundation`_. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing. The `NEWS`_ page describes the December 2022 GDAL/OGR 3.6.1 release.
GDAL is a translator library for raster and vector geospatial data formats that is released under an MIT style Open Source :ref:`license` by the `Open Source Geospatial Foundation`_. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing. The `NEWS`_ page describes the January 2023 GDAL/OGR 3.6.2 release.

.. image:: ../images/OSGeo_project.png
:alt: OSGeo project
:target: `Open Source Geospatial Foundation`_

.. _`Open Source Geospatial Foundation`: http://www.osgeo.org/
.. _`NEWS`: https://github.com/OSGeo/gdal/blob/v3.6.1/NEWS.md
.. _`NEWS`: https://github.com/OSGeo/gdal/blob/v3.6.2/NEWS.md

See :ref:`software_using_gdal`

Expand Down
13 changes: 13 additions & 0 deletions doc/source/community/service_providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ and related Open Source technologies.

`Faunalia`_ (Italy) is a company that operates since more than 15 years in the field of Geographic Information Systems (GIS) based on free and open source software (chiefly QGIS, PostGIS, and more). Our main customers are public administrations, private companies, associations. Faunalia has its main branch in Italy, and operates worldwide. Faunalia provides training services on GDAL.

.. container:: service-provider

|logo_kartoza|

.. container:: service-provider-description

`Kartoza`_ (South Africa) is a South Africa-based Free and Open Source GIS (FOSSGIS) service provider. We use GIS software to solve complex location-related problems for individuals, businesses and governments around the world. Kartoza provides training services on GDAL.

.. container:: service-provider

Expand Down Expand Up @@ -163,6 +170,12 @@ The steps to add a company to the service providers list are outlined in the :re
:width: 100 px
:target: `Faunalia`_

.. _`Kartoza`: https://kartoza.erpnext.com/
.. |logo_kartoza| image:: ../../images/logo-kartoza.png
:class: img-logos
:width: 100 px
:target: `Kartoza`_

.. _`mundialis`: https://www.mundialis.de/
.. |logo_mundialis| image:: ../../images/logo-mundialis.png
:class: img-logos
Expand Down
12 changes: 9 additions & 3 deletions doc/source/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@ Download
Current Release
------------------------------------------------------------------------------

* **2023-01-05** `gdal-3.6.2.tar.gz`_ `3.6.2 Release Notes`_ (`3.6.2 md5`_)

.. _`3.6.2 Release Notes`: https://github.com/OSGeo/gdal/blob/v3.6.2/NEWS.md
.. _`gdal-3.6.2.tar.gz`: https://github.com/OSGeo/gdal/releases/download/v3.6.2/gdal-3.6.2.tar.gz
.. _`3.6.2 md5`: https://github.com/OSGeo/gdal/releases/download/v3.6.2/gdal-3.6.2.tar.gz.md5

Past Releases
------------------------------------------------------------------------------

* **2022-12-11** `gdal-3.6.1.tar.gz`_ `3.6.1 Release Notes`_ (`3.6.1 md5`_)

.. _`3.6.1 Release Notes`: https://github.com/OSGeo/gdal/blob/v3.6.1/NEWS.md
.. _`gdal-3.6.1.tar.gz`: https://github.com/OSGeo/gdal/releases/download/v3.6.1/gdal-3.6.1.tar.gz
.. _`3.6.1 md5`: https://github.com/OSGeo/gdal/releases/download/v3.6.1/gdal-3.6.1.tar.gz.md5

Past Releases
------------------------------------------------------------------------------

* **2022-11-06** `3.6.0 Release Notes`_ *Warning*: this version has been official retracted and superseded per 3.6.1

.. _`3.6.0 Release Notes`: https://github.com/OSGeo/gdal/blob/v3.6.0/NEWS.md
Expand Down
10 changes: 5 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ If you are getting a ``<jemalloc>: arena 0 background thread creation failed (1)

# Images of releases

Tagged images of recent past releases are available. The last ones (at time of writing) are for GDAL 3.6.1 and PROJ 9.1.1, for linux/amd64 and linux/arm64:
* osgeo/gdal:alpine-small-3.6.1
* osgeo/gdal:alpine-normal-3.6.1
* osgeo/gdal:ubuntu-small-3.6.1
* osgeo/gdal:ubuntu-full-3.6.1
Tagged images of recent past releases are available. The last ones (at time of writing) are for GDAL 3.6.2 and PROJ 9.1.1, for linux/amd64 and linux/arm64:
* osgeo/gdal:alpine-small-3.6.2
* osgeo/gdal:alpine-normal-3.6.2
* osgeo/gdal:ubuntu-small-3.6.2
* osgeo/gdal:ubuntu-full-3.6.2

## Multi-arch Images

Expand Down
13 changes: 6 additions & 7 deletions frmts/grib/degrib/degrib/myerror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#endif



/*****************************************************************************
* AllocSprintf() -- Arthur Taylor / MDL (Review 12/2002)
*
Expand Down Expand Up @@ -178,7 +177,7 @@ static void AllocSprintf (char **Ptr, size_t *LenBuff, const char *fmt,
switch (flag) {
case 'l':
case 'L':
sprintf (bufpart, format, va_arg (ap, sInt4));
snprintf (bufpart, sizeof(bufpart), format, va_arg (ap, sInt4));
break;
/*
* gcc warning for 'h': "..." promotes short int to
Expand All @@ -188,11 +187,11 @@ static void AllocSprintf (char **Ptr, size_t *LenBuff, const char *fmt,
*/
/*
case 'h':
sprintf (bufpart, format, va_arg(ap, short int));
snprintf (bufpart, sizeof(bufpart), format, va_arg(ap, short int));
break;
*/
default:
sprintf (bufpart, format, va_arg (ap, int));
snprintf (bufpart, sizeof(bufpart), format, va_arg (ap, int));
}
slen = strlen (bufpart);
lenBuff += slen;
Expand All @@ -201,23 +200,23 @@ static void AllocSprintf (char **Ptr, size_t *LenBuff, const char *fmt,
ipos = lenBuff - 1;
break;
case 'f':
sprintf (bufpart, format, va_arg (ap, double));
snprintf (bufpart, sizeof(bufpart), format, va_arg (ap, double));
slen = strlen (bufpart);
lenBuff += slen;
buffer = (char *) realloc ((void *) buffer, lenBuff);
memcpy (buffer + ipos, bufpart, slen);
ipos = lenBuff - 1;
break;
case 'e':
sprintf (bufpart, format, va_arg (ap, double));
snprintf (bufpart, sizeof(bufpart), format, va_arg (ap, double));
slen = strlen (bufpart);
lenBuff += slen;
buffer = (char *) realloc ((void *) buffer, lenBuff);
memcpy (buffer + ipos, bufpart, slen);
ipos = lenBuff - 1;
break;
case 'g':
sprintf (bufpart, format, va_arg (ap, double));
snprintf (bufpart, sizeof(bufpart), format, va_arg (ap, double));
slen = strlen (bufpart);
lenBuff += slen;
buffer = (char *) realloc ((void *) buffer, lenBuff);
Expand Down
53 changes: 45 additions & 8 deletions frmts/jpeg/jpgdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3467,18 +3467,55 @@ void JPGDataset::EmitMessage(j_common_ptr cinfo, int msg_level)
// Create the message.
(*cinfo->err->format_message)(cinfo, buffer);

if (CPLTestBool(
CPLGetConfigOption("GDAL_ERROR_ON_LIBJPEG_WARNING", "NO")))
const char *pszVal =
CPLGetConfigOption("GDAL_ERROR_ON_LIBJPEG_WARNING", nullptr);
if (strstr(buffer, "Premature end of JPEG file"))
{
psUserData->bNonFatalErrorEncountered = true;
CPLError(CE_Failure, CPLE_AppDefined, "libjpeg: %s", buffer);
// Consider this an error by default
if (pszVal == nullptr || CPLTestBool(pszVal))
{
psUserData->bNonFatalErrorEncountered = true;
if (pszVal == nullptr)
{
CPLError(CE_Failure, CPLE_AppDefined,
"libjpeg: %s (this error can be turned as a "
"warning "
"by setting GDAL_ERROR_ON_LIBJPEG_WARNING to "
"FALSE)",
buffer);
}
else
{
CPLError(CE_Failure, CPLE_AppDefined, "libjpeg: %s",
buffer);
}
}
else
{
CPLError(CE_Warning, CPLE_AppDefined, "libjpeg: %s",
buffer);
}
}
else if (pszVal == nullptr || CPLTestBool(pszVal))
{
if (pszVal == nullptr)
{
CPLError(
CE_Warning, CPLE_AppDefined,
"libjpeg: %s (this warning can be turned as an error "
"by setting GDAL_ERROR_ON_LIBJPEG_WARNING to TRUE)",
buffer);
}
else
{
CPLError(CE_Warning, CPLE_AppDefined, "libjpeg: %s",
buffer);
}
}
else
{
CPLError(CE_Warning, CPLE_AppDefined,
"libjpeg: %s (this warning can be turned as an error "
"by setting GDAL_ERROR_ON_LIBJPEG_WARNING to TRUE)",
buffer);
psUserData->bNonFatalErrorEncountered = true;
CPLError(CE_Failure, CPLE_AppDefined, "libjpeg: %s", buffer);
}
}

Expand Down
4 changes: 4 additions & 0 deletions scripts/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ for f in $FILES; do
continue
;;

*frmts/grib/degrib/*)
continue
;;

*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
;;

Expand Down

0 comments on commit b0d6bab

Please sign in to comment.