source: zzuf/trunk/test/bug-memory.c @ 2560

Last change on this file since 2560 was 2560, checked in by sam, 6 years ago
  • bug-memory.c: fix the SIGSEGV unit test.
File size: 790 bytes
Line 
1/*
2 *  bug-memory - program exhausting the memory when fuzzed
3 *  Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id$
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16
17#include <stdio.h>
18#include <stdlib.h>
19
20int main(void)
21{
22    int i, ch;
23
24    while((ch = getc(stdin)) != EOF)
25    {
26        char *tmp = malloc(1 + ch * 1024 * 1024);
27        for(i = 0; i < 1024; i++)
28            tmp[ch * 1024 * i] = i;
29    }
30
31    return EXIT_SUCCESS;
32}
33
Note: See TracBrowser for help on using the repository browser.