[Issue 23409] New: ImportC: multiple usages of va_list produces garbage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 12 14:53:18 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23409
Issue ID: 23409
Summary: ImportC: multiple usages of va_list produces garbage
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
#include <stdio.h>
#include <stdarg.h>
void printf10(const char* fmt, ...){
for(int i = 0; i < 10; i++){
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
}
}
int main(){
printf10("Hello %s\n", "world");
return 0;
}
Example output of the above:
$ ./vap
Hello world
Hello �Ƚ
Hello �Ƚ
Segmentation fault: 11
Segfault occurs within a call to strlen (as it is strlen-ing garbage).
--
More information about the Digitalmars-d-bugs
mailing list