Skip to content

Instantly share code, notes, and snippets.

@moyix
Created July 10, 2016 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moyix/7117e2c29f3bf716e1047ceca5ffdc45 to your computer and use it in GitHub Desktop.
Save moyix/7117e2c29f3bf716e1047ceca5ffdc45 to your computer and use it in GitHub Desktop.
An example bug inserted by LAVA
int main(int argc, char **argv) {
FILE *f = fopen(argv[1], "rb");
file_header head;
parse_header(f, &head);
({
int lava_77 = 0;
lava_77 |= ((unsigned char *) &((head).reserved))[0] << (0*8);
lava_77 |= ((unsigned char *) &((head).reserved))[1] << (1*8);
lava_77 |= ((unsigned char *) &((head).reserved))[2] << (2*8);
lava_77 |= ((unsigned char *) &((head).reserved))[3] << (3*8);
lava_set(77,lava_77);
int rv = printf("File timestamp: %u\n", head.timestamp);
rv;
});
unsigned i;
for (i = 0; i < head.num_recs; i++) {
file_entry *ent = parse_record(f);
consume_record(ent+(lava_get(77))*(0x6c617614==(lava_get(77))||0x1476616c==(lava_get(77))));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment