-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
Description
Bugzilla Link | 41311 |
Version | trunk |
OS | Linux |
CC | @Aaron1011,@devincoughlin,@jyn514,@haoNoQ |
Extended Description
When running the clang-analyzer checks under clang-tidy, the clang-analyzer-valist.Uninitialized warning is firing on a valist copied using va_copy().
Command: clang-tidy --checks="-,clang-analyzer-" example.cpp
Minimal example.cpp:
#include <stdarg.h>
#include <stdio.h>
void StringVPrintf(const char* format, va_list ap) {
char stack_buf[1024u];
va_list ap_copy;
va_copy(ap_copy, ap);
vsnprintf(stack_buf, 1024u, format, ap_copy);
va_end(ap_copy);
}
Clang-tidy warning:
example.cpp:8:5: warning: Function 'vsnprintf' is called with an uninitialized va_list argument [clang-analyzer-valist.Uninitialized]
vsnprintf(stack_buf, 1024u, format, ap_copy);
^
example.cpp:8:5: note: Function 'vsnprintf' is called with an uninitialized va_list argument
vegerot and lePerdu