libgis: G_vasprintf bug fix#3650
Conversation
|
@nilason What's your opinion on this? It was fixing a bug 6 months ago caught in the cmake PR. |
|
The build errors were no longer visible, so I updated the branch again. |
|
The error is Details: |
| va_end(ap); | ||
|
|
||
| for (;;) { | ||
| if (count >= osize) { |
There was a problem hiding this comment.
This addresses the warning, and take into account if the previous vsnprintf call fails.
| if (count >= osize) { | |
| if (count < 0) | |
| return count; | |
| if ((size_t)count >= osize) { |
|
Should we update the branch first? |
|
@HuidaeCho shall we push this for 8.5? |
Yes. Let's push it. |
|
There was a compiler warning to which I had a suggestion. That warning should be addressed and let us update the branch before merge. |
I'll take a look into it this weekend. |
This PR fixes a
G_vasprintfbug for#elseof#ifdef HAVE_ASPRINTF.From the man page of
vsnprintf():size *= 2becausecountis already the full length without\0if it's greater than or equal tosize.apcannot be reused in a for loop. It needs to be copied before its first use so we can use it again.