source: rtems/testsuites/sptests/spfatal32/testcase.h @ 99de42c

5
Last change on this file since 99de42c was de9b7d7, checked in by Sebastian Huber <sebastian.huber@…>, on 06/01/18 at 05:04:45

Add RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE

An invalid heap usage such as a double free is usually a fatal error
since this indicates a use after free. Replace the use of printk() in
free() with a fatal error.

Update #3437.

  • Property mode set to 100644
File size: 675 bytes
Line 
1/*
2 * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#include <stdint.h>
16#include <stdlib.h>
17
18#define FATAL_ERROR_TEST_NAME       "32"
19#define FATAL_ERROR_DESCRIPTION     "invalid free of heap memory"
20#define FATAL_ERROR_EXPECTED_SOURCE RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE
21#define FATAL_ERROR_EXPECTED_ERROR  1
22
23void force_error()
24{
25  uintptr_t invalid = 1;
26  free((void *) invalid);
27}
Note: See TracBrowser for help on using the repository browser.