Fuzzed - a program to find DMDFE parser crash

Basile B. b2.temp at gmx.com
Sun Dec 16 05:49:03 UTC 2018


On Saturday, 15 December 2018 at 21:09:12 UTC, Sebastiaan Koppe 
wrote:
> On Saturday, 15 December 2018 at 15:37:19 UTC, Basile B. wrote:
>> I think this is what Walter calls "AST poisoning" (never 
>> understood how it worked before today). And the whole parser 
>> is like this.
>>
>> This poisoning kills the interest of using a fuzzer. 99% of 
>> the crashes will be in hdrgen.
>
> As is common with fuzzing, you'll need to ensure the program 
> crashes.

Yes this is done by piping dmd with the random code (i dont use 
dmd as a library for now). If the process returns something 
different of 0 (ok) and 1 (normal compiler error) than the random 
code is saved in a file:

         ...
         ProcessPipes pp = pipeProcess([Options.dc, "-"]);
         pp.stdin.writeln(src);
         pp.stdin.close;
         if (!pp.pid.wait.among(0, 1)) fileName.write(src);
         ...

Actually it would be less convenient to do that with the front 
end as a library, since SEGFAULTs are supposed to kill the 
program...






More information about the Digitalmars-d-announce mailing list