OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 | |
12 /* This code is in the public domain. | |
13 ** Version: 1.1 Author: Walt Karas | |
14 */ | |
15 | |
16 /* The function in this file performs default actions if self-auditing | |
17 ** finds heap corruption. Don't rely on this code to handle the | |
18 ** case where HMM is being used to implement the malloc and free standard | |
19 ** library functions. Rewrite the function if necessary to avoid using | |
20 ** I/O and execution termination functions that call malloc or free. | |
21 ** In Unix, for example, you would replace the fputs calls with calls | |
22 ** to the write system call using file handle number 2. | |
23 */ | |
24 #include "hmm_intrnl.h" | |
25 #include <stdio.h> | |
26 #include <stdlib.h> | |
27 | |
28 static int entered = 0; | |
29 | |
30 /* Print abort message, file and line. Terminate execution. | |
31 */ | |
32 void hmm_dflt_abort(const char *file, const char *line) { | |
33 /* Avoid use of printf(), which is more likely to use heap. */ | |
34 | |
35 if (entered) | |
36 | |
37 /* The standard I/O functions called a heap function and caused | |
38 ** an indirect recursive call to this function. So we'll have | |
39 ** to just exit without printing a message. */ | |
40 while (1); | |
41 | |
42 entered = 1; | |
43 | |
44 fputs("\n_abort - Heap corruption\n" "File: ", stderr); | |
45 fputs(file, stderr); | |
46 fputs(" Line: ", stderr); | |
47 fputs(line, stderr); | |
48 fputs("\n\n", stderr); | |
49 fputs("hmm_dflt_abort: while(1)!!!\n", stderr); | |
50 fflush(stderr); | |
51 | |
52 while (1); | |
53 } | |
OLD | NEW |