#3006: Large attribute table causes buffer overflow in v.db.select
-------------------------+-------------------------
Reporter: marisn | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: wxGUI | Version: svn-trunk
Keywords: v.db.select | CPU: Unspecified
Platform: Linux |
-------------------------+-------------------------
wxGUI attribute table window is trying to load all values from the
attribute table. In case of large number of values, it is causing an
overflow in v.db.select. wxGUI should not attempt to load more than N rows
at the time (where 100 > N >= 1000).
#3006: Large attribute table causes buffer overflow in v.db.select
--------------------------+-------------------------
Reporter: marisn | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: v.db.select
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Comment (by marisn):
Replying to [comment:1 annakrat]:
> Aren't these 2 separate issues? First is v.db.select crashing and second
is opening large tables in attribute table manager.
I haven't been reading the code, still I believe the overflow is caused by
behaviour of wxGUI as it happened when I was trying to view attribute
table of vector map. The question is if we should fix v.db.selec as many
parts of GRASS would fail if abused (just grep for fixed buffer sizes in C
files to get an idea).
#3006: Large attribute table causes buffer overflow in v.db.select
--------------------------+-------------------------
Reporter: marisn | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: v.db.select
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Comment (by annakrat):
Replying to [comment:2 marisn]:
> Replying to [comment:1 annakrat]:
> > Aren't these 2 separate issues? First is v.db.select crashing and
second is opening large tables in attribute table manager.
> I haven't been reading the code, still I believe the overflow is caused
by behaviour of wxGUI as it happened when I was trying to view attribute
table of vector map. The question is if we should fix v.db.selec as many
parts of GRASS would fail if abused (just grep for fixed buffer sizes in C
files to get an idea).
The backtrace comes from v.db.select, so we should start there. Loading
data in attribute manager is separate issue. Run v.db.select from command
line, you should get the backtrace. But to fix it we need reproducible
example, so if you can't reproduce it on North Carolina, your data is
needed or at least a way to generate the data which lead to the crash.
Sorry, Anna, I was partially wrong. After examining dbmgr.base
!VirtualAttributeList with lots of print's, I came down to line joining
all column names to pass them to v.db.select.
([https://trac.osgeo.org/grass/browser/grass/trunk/gui/wxpython/dbmgr/base.py#L210
Line 120 of dbmgr/base.py]) Thus it was causing an overflow in select
statement of v.db.select and I could not see it from CLI, as I was running
it without explicitly stating all columns. Once I saw exact command
executed by wxGUI, fixing it was easy.
I bumped up string buffer for storing query from 1024 to 4096 in r68321
(backported to 7.0 in r68322). Should be enough for most of cases as "640k
should be enough for everyone".