| | @@ -59,10 +59,11 @@ |
| 59 | 59 | ** Type of fuzzing: |
| 60 | 60 | */ |
| 61 | 61 | #define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */ |
| 62 | 62 | #define FUZZ_MARKDOWN 1 /* The Markdown formatter */ |
| 63 | 63 | #define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */ |
| 64 | +#define FUZZ_WIKI2 3 /* FOSSIL_WIKI and FOSSIL_MARKDOWN */ |
| 64 | 65 | #endif |
| 65 | 66 | |
| 66 | 67 | /* The type of fuzzing to do */ |
| 67 | 68 | static int eFuzzType = FUZZ_WIKI; |
| 68 | 69 | |
| | @@ -73,17 +74,32 @@ |
| 73 | 74 | blob_init(&in, 0, 0); |
| 74 | 75 | blob_append(&in, (char*)aData, (int)nByte); |
| 75 | 76 | blob_zero(&out); |
| 76 | 77 | switch( eFuzzType ){ |
| 77 | 78 | case FUZZ_WIKI: { |
| 79 | + wiki_convert(&in, &out, 0); |
| 80 | + blob_reset(&out); |
| 81 | + break; |
| 82 | + } |
| 83 | + case FUZZ_MARKDOWN: { |
| 84 | + Blob title = BLOB_INITIALIZER; |
| 85 | + blob_reset(&out); |
| 86 | + markdown_to_html(&in, &title, &out); |
| 87 | + blob_reset(&title); |
| 88 | + break; |
| 89 | + } |
| 90 | + case FUZZ_WIKI2: { |
| 78 | 91 | Blob title = BLOB_INITIALIZER; |
| 79 | 92 | wiki_convert(&in, &out, 0); |
| 80 | 93 | blob_reset(&out); |
| 81 | 94 | markdown_to_html(&in, &title, &out); |
| 82 | 95 | blob_reset(&title); |
| 83 | 96 | break; |
| 84 | 97 | } |
| 98 | + case FUZZ_ARTIFACT: |
| 99 | + fossil_fatal("FUZZ_ARTIFACT is not implemented."); |
| 100 | + break; |
| 85 | 101 | } |
| 86 | 102 | blob_reset(&in); |
| 87 | 103 | blob_reset(&out); |
| 88 | 104 | return 0; |
| 89 | 105 | } |
| | @@ -98,10 +114,12 @@ |
| 98 | 114 | zType = find_option("fuzztype",0,1); |
| 99 | 115 | if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){ |
| 100 | 116 | eFuzzType = FUZZ_WIKI; |
| 101 | 117 | }else if( fossil_strcmp(zType,"markdown")==0 ){ |
| 102 | 118 | eFuzzType = FUZZ_MARKDOWN; |
| 119 | + }else if( fossil_strcmp(zType,"wiki2")==0 ){ |
| 120 | + eFuzzType = FUZZ_WIKI2; |
| 103 | 121 | }else{ |
| 104 | 122 | fossil_fatal("unknown fuzz type: \"%s\"", zType); |
| 105 | 123 | } |
| 106 | 124 | } |
| 107 | 125 | |
| | @@ -117,17 +135,18 @@ |
| 117 | 135 | } |
| 118 | 136 | |
| 119 | 137 | /* |
| 120 | 138 | ** COMMAND: test-fuzz |
| 121 | 139 | ** |
| 122 | | -** Usage: %fossil test-fuzz [-type TYPE] INPUTFILE... |
| 140 | +** Usage: %fossil test-fuzz [-fuzztype TYPE] INPUTFILE... |
| 123 | 141 | ** |
| 124 | 142 | ** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of: |
| 125 | 143 | ** |
| 126 | 144 | ** wiki Fuzz the Fossil-wiki translator |
| 127 | 145 | ** markdown Fuzz the markdown translator |
| 128 | 146 | ** artifact Fuzz the artifact parser |
| 147 | +** wiki2 Fuzz the Fossil-wiki and markdown translator |
| 129 | 148 | */ |
| 130 | 149 | void fuzz_command(void){ |
| 131 | 150 | Blob in; |
| 132 | 151 | int i; |
| 133 | 152 | fuzzer_options(); |
| 134 | 153 | |