From: Michael R Sweet Date: Mon, 29 Mar 2021 00:55:52 +0000 (-0400) Subject: Add write test and more transformations in fuzz function. X-Git-Tag: v2.4b1~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd75df7c1a35ca548842f9585b57c71a71e2d76;p=thirdparty%2Fcups.git Add write test and more transformations in fuzz function. --- diff --git a/cups/fuzzipp.c b/cups/fuzzipp.c index 9ad7537b4e..ffdb3485ce 100644 --- a/cups/fuzzipp.c +++ b/cups/fuzzipp.c @@ -187,8 +187,20 @@ main(int argc, // I - Number of command-line arguments } while (state == IPP_STATE_ATTRIBUTE); - ippDelete(request); cupsFileClose(fp); + + fp = cupsFileOpen("/dev/null", "w"); + + ippSetState(request, IPP_STATE_IDLE); + + do + { + state = ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL, request); + } + while (state == IPP_STATE_ATTRIBUTE); + + cupsFileClose(fp); + ippDelete(request); } return (0); @@ -210,7 +222,7 @@ fuzzdata(_ippdata_t *data) // I - Data buffer // Mutate a few times... - for (i = 0; i < 10; i ++) + for (i = 0; i < 32; i ++) { // Each cycle remove or move bytes switch (CUPS_RAND() & 7)