... The current memory limit (50.0 MB) is too low for this program ...
You can use -t and -m to override the default timeout and memory limit for the executed process; rare examples of targets that may need these settings touched include compilers and video decoders.
My tested C program, test.c, that triggers the issue above is quite simple:"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[])
{
int val;
scanf("%d", &val);
if (val < 0){
assert(1==2);
return 1;
}
else{
printf("%d\n",val);
assert(4==5);
return 0;
}
}cd Mytest; ../afl-gcc test.c; cd ..;
./afl-fuzz -i Mytest -o Mytest_o -- Mytest/a.outHi again,
I got a strange error message when testing a simple program:... The current memory limit (50.0 MB) is too low for this program ...
int main(int argc, char *argv[])
{
int val;
scanf("%d", &val);
if (val < 0){
return 0;
}
else {
printf("%d\n",val);
return 1;
}
} [+] AFL test case: id:000001,orig:test.c (1 / 3), cycle: 0
lines......: 83.3% (5 of 6 lines)
functions..: 100.0% (1 of 1 function)
branches...: 50.0% (1 of 2 branches)
[+] AFL test case: id:000002,src:000001,op:flip1,pos:0,+cov (2 / 3), cycle: 0
lines......: 83.3% (5 of 6 lines)
functions..: 100.0% (1 of 1 function)
branches...: 50.0% (1 of 2 branches)
[+] Processed 3 / 3 test cases.
[+] Final zero coverage report: ../Mytest_o/cov/zero-cov
[+] Final positive coverage report: ../Mytest_o/cov/pos-cov
lines......: 83.3% (5 of 6 lines)
functions..: 100.0% (1 of 1 function)
branches...: 50.0% (1 of 2 branches)
[+] Final lcov web report: ../Mytest_o/cov/web/index.html
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[])
{
int cmdval;
scanf("%d", &cmdval);
if (cmdval < 0){
//assert(1==2);
return 1;
}
else {
printf("%d\n",cmdval);
// assert(4==5);
return 1;
}
}Have you looked at the generated test cases in the queue/
subdirectory? You have several; what's in them?
--
You received this message because you are subscribed to the Google Groups "afl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to afl-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
for i in queue/; do cat $i | xxd; done
> 7f45 4c46 -> 2135247942
> 2369 6e63 -> 594112099
> 3369 6e63 -> 862547555
You're doing scanf("%d"). That just expects a human-readable decimal
ASCII representation of a signed integer. In that context, this
conversion is meaningless.
On Oct 11, 2016, at 7:04 PM, Zhoulai Fu <zhoul...@gmail.com> wrote:> 7f45 4c46 -> 2135247942There should be a misunderstanding. The three hex numbers are test inputs retrieved with Brendon's command line. I was suggested to see what integer inputs afl-fuzz generates exactly. They have nothing to do with scanf ("%d").
> 2369 6e63 -> 594112099
> 3369 6e63 -> 862547555
You're doing scanf("%d"). That just expects a human-readable decimal
ASCII representation of a signed integer. In that context, this
conversion is meaningless.
Can someone try out my test program? It is only 20 lines. My finding is that afl-fuzz does not generate a single negative integer for 30 minutes. But I am unsure whether I should use configurations other than the default ones.
Z.
Zhoulai
As mentioned, I'm pretty sure that AFL is working correctly. Your
program is using uninitialized variables and is being given garbage
inputs, producing some non-deterministic behavior when you're trying
to measure coverage later on, but that's not a bug in AFL.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[])
{
int cmdval;
scanf("%d", &cmdval);
if (cmdval < 0)
return 0;
else
return 1;
}