Skip to content

test_suite_memory_buffer_alloc says "FATAL: verification of first header failed" but passes #309

@gilles-peskine-arm

Description

@gilles-peskine-arm

Description

Steps to reproduce:

scripts/config.pl set MBEDTLS_MEMORY_BUFFER_ALLOC_C
scripts/config.pl set MBEDTLS_MEMORY_DEBUG
scripts/config.pl set MBEDTLS_PLATFORM_MEMORY
make lib tests
tests/test_suite_memory_buffer_alloc

Output (at least on Ubuntu 16.04 x86_64):

Memory buffer alloc self test ..................................... PASS
Memory buffer alloc - free in middle, alloc at end ................ PASS
Memory buffer alloc - free in middle, realloc ..................... PASS
Memory buffer alloc - free in middle, merge, realloc .............. PASS
Memory buffer alloc - free at end, merge, realloc ................. PASS
Memory buffer alloc - Out of Memory test .......................... PASS
Memory buffer small buffer ........................................ FATAL: verification of first header failed
PASS
Memory buffer underalloc .......................................... PASS

----------------------------------------------------------------------------

PASSED (8 / 8 tests (0 skipped))

There are two bugs here:

  1. FATAL: verification of first header failed indicates memory corruption (unless the bug is in the test code).
  2. If a tests reveals a FATAL error, the test must not come up as PASSED.

I'm filing these bugs together because they may have the same root cause. If you fix one without fixing the other, please file an issue for the remaining bug.

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions