Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebird::string::vprintf() fails with long resulting string [CORE1692] #2117

Closed
firebird-automations opened this issue Jan 14, 2008 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @AlexPeshkoff

If length of resulting string exceeds static buffer size (tempsize in vprintf()), next call to standard vsnprintf() function fails with AV.

Commits: 42be054 0a1e9ff

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

The reason is that using same va_list variable for multiple calls of vsnprintf() (or any other function accepting vararg argument) is wrong - va_copy() should be used according to C99 standard. MSVC does bot follow standard and does not provide va_copy() macro, therefore - conditional compilation required here. Assumption is made that if compiler does not provide va_copy() macro, plain assignment for va_list is possible.

To be backported to 2.0/2.1.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Fix Version: 2.5 Alpha 1 [ 10224 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

For platforms, having va_copy() macro, use it (in pair with va_end()).
If va_copy() is missing, fallback to old behavior using C assignment of va_list. And hope that if va_copy() is actually needed, it will be present.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.4 [ 10211 ]

Fix Version: 2.1.0 [ 10041 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 13820 ] => Firebird [ 14112 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.1 RC2 [ 10250 ]

Fix Version: 2.1.0 [ 10041 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Cannot be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment