Skip to content

Comments

diglib: Calculate the total size of topo file to get the correct off_t_size#3163

Closed
HuidaeCho wants to merge 119 commits intoOSGeo:mainfrom
HuidaeCho:diglib_topo_offset
Closed

diglib: Calculate the total size of topo file to get the correct off_t_size#3163
HuidaeCho wants to merge 119 commits intoOSGeo:mainfrom
HuidaeCho:diglib_topo_offset

Conversation

@HuidaeCho
Copy link
Member

off_t sizes for coor and topo files can be different. For example, from an EPSG:4326 location,

> v.mkgrid map=grids_00625deg position=coor coor=-180,-90 box=0.0625,0.0625 grid=2880,5760
> d.mon wx0
> d.vect grids_00625deg
ERROR: Unable to seek: Invalid argument

> ls -al .../vector/grids_00625deg
-rw-r--r-- 1 hcho users 1708966098 Sep 17 22:35 coor
-rw-r--r-- 1 hcho users         95 Sep 17 22:33 dbln
-rw-r--r-- 1 hcho users        173 Sep 17 22:33 head
-rw-r--r-- 1 hcho users        260 Sep 17 22:33 hist
-rw-r--r-- 1 hcho users 6706995200 Sep 17 22:45 sidx
-rw-r--r-- 1 hcho users 2173694570 Sep 17 22:45 topo

coor_size is less than PORT_LONG_MAX (2^31 - 1 = 2147483647; max int), but the topo size is greater than that. Setting ptr->off_t_size = 4 in

if (ptr->coor_size > (off_t)PORT_LONG_MAX) {
/* can only happen when sizeof(off_t) == 8 */
ptr->off_t_size = 8;
}
else
ptr->off_t_size = 4;
causes an integer overflow and ptr->Isle_offset is read as -2121341854 in
if (0 >= dig__fread_port_O(&(ptr->Isle_offset), 1, fp, ptr->off_t_size))

This PR calculates the total size of topo file to get the correct off_t_size. Before this PR, the size of coor file was used to determine this offset size for topo file.

@HuidaeCho HuidaeCho added vector Related to vector data processing bug Something isn't working C Related code is in C backport to 8.3 labels Sep 18, 2023
@HuidaeCho HuidaeCho requested a review from metzm September 19, 2023 22:27
@neteler neteler added this to the 8.4.0 milestone Oct 5, 2023
@wenzeslaus
Copy link
Member

...ptr->off_t_size is shared between coor and topo files as of now...

Can you please add documentation for these things? Preferably also something in the Doxygen API-level doc.

tmszi and others added 18 commits January 9, 2024 09:54
… of the vector map (OSGeo#3087)

* Use gs.find_file() func instead of pygrass module
… drawing items (OSGeo#3162)

Device context DrawTex() and DrawLine() method require input x, y
parameter argument type as integer type.
Rectangle widget with integer coordinates Offset() method dx, dy
parameters require integer argument type.
…rs (OSGeo#3168)

Addon module name start with db.*, ps.*, r3.*, wx.*, during installation
on the OS MS Windows platform.
* Translated using Weblate (Russian)

Currently translated at 100.0% (2193 of 2193 strings)

Translation: GRASS GIS/grasslibs
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasslibs/ru/

* Translated using Weblate (Russian)

Currently translated at 97.6% (4277 of 4380 strings)

Translation: GRASS GIS/grasswxpy
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasswxpy/ru/

* Translated using Weblate (Russian)

Currently translated at 0.9% (121 of 12647 strings)

Translation: GRASS GIS/grassmods
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grassmods/ru/

* Translated using Weblate (German)

Currently translated at 40.0% (879 of 2197 strings)

Translation: GRASS GIS/grasslibs
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasslibs/de/

* Translated using Weblate (Russian)

Currently translated at 100.0% (2193 of 2193 strings)

Translation: GRASS GIS/grasslibs
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasslibs/ru/

* Translated using Weblate (German)

Currently translated at 34.4% (4394 of 12767 strings)

Translation: GRASS GIS/grassmods
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grassmods/de/

* Translated using Weblate (Russian)

Currently translated at 100.0% (4380 of 4380 strings)

Translation: GRASS GIS/grasswxpy
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasswxpy/ru/

* Translated using Weblate (Russian)

Currently translated at 1.4% (182 of 12647 strings)

Translation: GRASS GIS/grassmods
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grassmods/ru/

* Translated using Weblate (German)

Currently translated at 34.4% (4403 of 12767 strings)

Translation: GRASS GIS/grassmods
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grassmods/de/

* Translated using Weblate (German)

Currently translated at 40.2% (885 of 2197 strings)

Translation: GRASS GIS/grasslibs
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasslibs/de/

* Translated using Weblate (German)

Currently translated at 61.9% (2734 of 4415 strings)

Translation: GRASS GIS/grasswxpy
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasswxpy/de/

---------

Co-authored-by: Sergey Kazorin <[email protected]>
Co-authored-by: Markus <[email protected]>
Co-authored-by: Weblate <[email protected]>
Currently translated at 22.3% (489 of 2187 strings)

Translation: GRASS GIS/grasslibs
Translate-URL: https://weblate.osgeo.org/projects/grass-gis/grasslibs/ko/

Co-authored-by: Huidae Cho <[email protected]>
…OSGeo#3189)

Remove vertical sizer Add() method flags parameter argument
wx.ALIGN_CENTER_VERTICAL flag. Only horizontal alignment flags can be
used in vertical sizers.
…SGeo#3177)

* wxGUI/main_window: add and use custom SingleWindowAuiManager class

Which override base OnClose window close event handler method
to prevent prematurely uninitialize manager.

wxWidgets/Phoenix#2460

* Update the package documentation class list
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
@github-actions github-actions bot added RFC Request For Comment (RFC) document libraries module docs markdown Related to markdown, markdown files labels Jan 9, 2024
@HuidaeCho
Copy link
Member Author

Oh! I messed it up... Closing it for now.

@HuidaeCho
Copy link
Member Author

...ptr->off_t_size is shared between coor and topo files as of now...

Can you please add documentation for these things? Preferably also something in the Doxygen API-level doc.

Added it in #3351

@neteler neteler removed GUI wxGUI related macOS macOS specific docker Docker related CI Continuous integration vector Related to vector data processing raster Related to raster data processing temporal Related to temporal data processing Python Related code is in Python C++ Related code is in C++ HTML Related code is in HTML translation Message translation related database Related to database management RFC Request For Comment (RFC) document backport to 8.3 libraries module docs markdown Related to markdown, markdown files labels Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C Related code is in C

Projects

None yet

Development

Successfully merging this pull request may close these issues.