-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
[BUG] Format error occurs when the specified width is less than the left aligned data length #2221
Comments
I can open a pull request if needed. |
I think it is caused by the following lines of code not handling the width variable correctly:
It should be modified to: while ((width-- > 0) && maxlen) Just like here:
|
* 采用适配器设计模式重构 logger handle、sink handle * 修复 Logger.Get() 可能泄露 handle 的问题 * 修复 Logger.AddSink(), Logger.DropSink(), Logger.SetErrorHandler() 的线程安全问题 * Logger.DropSink() 返回值由 bool -> void * 重构 Logger 的错误处理器 Logger.SetErrorHandler(Log4spErrorCallback callback); -> Logger.SetErrorHandler(LoggerErrorHandler handler); Log4spErrorCallback -> LoggerErrorHandler function void (const char[] msg); -> function void (Logger logger, const char[] msg); * 恢复了 Logger.***AmxTpl() API 与之前相同,依然使用 SM 提供的 format 会中断 sourcepawn 代码 长度超过 2048 会被截断 格式化存在 BUG(alliedmodders/sourcemod#2221) 但是性能应该稍快一点 (5~8%) * 增强宏 LOG4SP_NO_EXT * 更新注释文档 * 重命名 sink 构造函数参数 async -> multiThread * 重构 Sink 过滤器 ClientChatSinkFilter -> SinkClientFilter * 移除 Sink 多余的记录日志 API(只保留一个记录原始日志的API)
Description
If a specified width is smaller than the length of the actual data and left alignment is chosen, the formatted output erroneously appends extra characters until the buffer is filled.
Problematic Code (or Steps to Reproduce)
Logs
Expected:
Actual:
The text was updated successfully, but these errors were encountered: