Skip to content

v.patch: increase the buffer for column names - #7351

Merged
metzm merged 4 commits into
OSGeo:mainfrom
metzm:v.patch_colnamesbuffer
Apr 30, 2026
Merged

metzm merged 4 commits into
OSGeo:mainfrom
metzm:v.patch_colnamesbuffer

Conversation

@metzm

@metzm metzm commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Currently, v.patch -e fails with an overflow error if the input tables contain many columns whose names are concatenated longer than 4096 characters. This PR increases the limit to DB_SQL_MAX = 65536 and adds tests to avoid buffer overflow.

@metzm metzm added this to the 8.6.0 milestone Apr 29, 2026
@metzm
metzm requested a review from nilason April 29, 2026 15:13
@metzm metzm added bug Something isn't working vector Related to vector data processing C Related code is in C module backport to 8.4 PR needs to be backported to release branch 8.4 backport to 8.5 PR needs to be backported to release branch 8.5 labels Apr 29, 2026
Comment thread vector/v.patch/main.c Resolved
Comment thread vector/v.patch/main.c Resolved
Comment thread vector/v.patch/main.c Resolved
@nilason

nilason commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

As a parenthesis, both snprintf and G_strlcat (and similar functions) truncates the resulting string if the attempted string do not fit the buffer, so there will be no overflow (but obviously other issues).

metzm and others added 2 commits April 30, 2026 11:00
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
nilason
nilason previously approved these changes Apr 30, 2026

@nilason nilason left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread vector/v.patch/main.c Resolved
@metzm
metzm merged commit e2594a7 into OSGeo:main Apr 30, 2026
26 checks passed
@metzm
metzm deleted the v.patch_colnamesbuffer branch April 30, 2026 15:04
metzm added a commit that referenced this pull request Apr 30, 2026
* larger buffer for column names
* simplify code
* fix comparison of integers of different signedness

---------

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
metzm added a commit that referenced this pull request Apr 30, 2026
* larger buffer for column names
* simplify code
* fix comparison of integers of different signedness

---------

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
@wenzeslaus wenzeslaus removed backport to 8.4 PR needs to be backported to release branch 8.4 backport to 8.5 PR needs to be backported to release branch 8.5 labels May 6, 2026
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Jul 7, 2026
* larger buffer for column names
* simplify code
* fix comparison of integers of different signedness

---------

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
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 module vector Related to vector data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants