Possible server/utilities hang because of infinity loop in AbstractString::vprintf [CORE6012] #6262
Labels
affect-version: 3.0.0
affect-version: 3.0.1
affect-version: 3.0.2
affect-version: 3.0.3
affect-version: 3.0.4
affect-version: 3.0.5
affect-version: 3.0.6
affect-version: 4.0 Alpha 1
affect-version: 4.0 Beta 1
affect-version: 4.0 Beta 2
affect-version: 4.0 Initial
component: engine
priority: major
resolution: wontfix
type: bug
Submitted by: @artyom-smirnov
The problem is because only result of vsnprintf checked, but not cause of this result (e.g. errno).
One of case with this issue I've got and reproduced is hanging gsec on CentOS 6 which have bug in glibc (https://sourceware.org/bugzilla/show_bug.cgi?id=6530)
For example simple reproduction for FB 3.x/4.x: shutdown server, create system audit file with service auditing and add it to firebird.conf:
services
{
enabled = true
log_filename = /tmp/log
log_services = true
log_service_query = false
}
Run gsec with locale which is not POSIX or C:
LANG=en_US.utf8 bin/gsec -user SYSDBA -password masterkey -add test -pw test
vprintf will get string like "-user SYSDBA -ADD \377TEST\377 -PW \377test\377" and will hang on it, because vsnprintf result always be -1 and errno always be 84.
All versions affected by infinity loop hang, because this part of code is same, but this particular case of course will hang only on 3.x/4.x.
What about:
1. Checking errno in vprintf and at least throw exception instead hang?
2. Cleanup service terminal symbols in TracePluginImpl::log_event_service_start before passing it to vprintf?
The text was updated successfully, but these errors were encountered: