2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* This code is in the public domain.
|
|
|
|
** Version: 1.1 Author: Walt Karas
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* The function in this file performs default actions if self-auditing
|
|
|
|
** finds heap corruption. Don't rely on this code to handle the
|
|
|
|
** case where HMM is being used to implement the malloc and free standard
|
|
|
|
** library functions. Rewrite the function if necessary to avoid using
|
|
|
|
** I/O and execution termination functions that call malloc or free.
|
|
|
|
** In Unix, for example, you would replace the fputs calls with calls
|
|
|
|
** to the write system call using file handle number 2.
|
|
|
|
*/
|
|
|
|
#include "hmm_intrnl.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
static int entered = 0;
|
|
|
|
|
|
|
|
/* Print abort message, file and line. Terminate execution.
|
|
|
|
*/
|
2012-07-14 00:21:29 +02:00
|
|
|
void hmm_dflt_abort(const char *file, const char *line) {
|
|
|
|
/* Avoid use of printf(), which is more likely to use heap. */
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (entered)
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* The standard I/O functions called a heap function and caused
|
|
|
|
** an indirect recursive call to this function. So we'll have
|
|
|
|
** to just exit without printing a message. */
|
|
|
|
while (1);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
entered = 1;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fputs("\n_abort - Heap corruption\n" "File: ", stderr);
|
|
|
|
fputs(file, stderr);
|
|
|
|
fputs(" Line: ", stderr);
|
|
|
|
fputs(line, stderr);
|
|
|
|
fputs("\n\n", stderr);
|
|
|
|
fputs("hmm_dflt_abort: while(1)!!!\n", stderr);
|
|
|
|
fflush(stderr);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
while (1);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|