[PATCH] Custom wrappers for DFSanitizing sprintf & snprintf

Lorenzo Martignoni martignlo at google.com
Mon Oct 6 09:24:23 PDT 2014

Comment at: test/dfsan/custom.c:806
@@ +805,3 @@
+  // Test formatting of all supported types of format strings.
+#define ASSERT_SPRINTF(expected, fmt, arg) {             \
+    memset(buf, 'a', sizeof(buf));                       \
martignlo wrote:
> pcc wrote:
> > Please modify this macro to check labels (in both the unlabelled and labelled cases). You already have a test for %s above so you don't need to check it here.
> > 
> > Though I would much prefer if this could be done without macros. Maybe we can move these tests to a .cc file and use templates?
> I renamed the file to custom.cc so that we can use a template. Now the tests also labels the arguments and makes sure the labels are applied to the correct part of the output buffer. 
> Do you think it is necessary to try the same passing a zero-label?
Ok. Now each string is formatted twice, with and without a labelled argument.


More information about the llvm-commits mailing list