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 28static int entered = 0; 29 30/* Print abort message, file and line. Terminate execution. 31*/ 32void hmm_dflt_abort(const char *file, const char *line) 33{ 34 /* Avoid use of printf(), which is more likely to use heap. */ 35 36 if (entered) 37 38 /* The standard I/O functions called a heap function and caused 39 ** an indirect recursive call to this function. So we'll have 40 ** to just exit without printing a message. */ 41 while (1); 42 43 entered = 1; 44 45 fputs("\n_abort - Heap corruption\n" "File: ", stderr); 46 fputs(file, stderr); 47 fputs(" Line: ", stderr); 48 fputs(line, stderr); 49 fputs("\n\n", stderr); 50 fputs("hmm_dflt_abort: while(1)!!!\n", stderr); 51 fflush(stderr); 52 53 while (1); 54} 55