[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/4] tools/fuzz: add AFL stub program for x86 insn emulator fuzzer



On Tue, Jan 24, 2017 at 05:05:16PM +0000, Ian Jackson wrote:
> Wei Liu writes ("[PATCH 2/4] tools/fuzz: add AFL stub program for x86 insn 
> emulator fuzzer"):
> > This is a basic program to call into the unified fuzzing function.
> ...
> > +    fd = open(argv[1], O_RDONLY, 0);
> > +    assert(fd != -1);
> > +    size = read(fd, input, sizeof(input));
> 
> Why do you use open and read here rather than fopen and fread ?
> 

No particular reason.

> If you use read you ought to put it in a loop to cope with potential
> partial reads.
> 

Does fread have better properties than read? I think to deal with short
read we would need to stat the file to get actual size for both fread
and read, right? If so I will just stick with read and put that in a
loop.

Wei.

> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.