+2021-12-23 Mark Wielaard <mark@klomp.org>
+
+ * core-file.c (dwfl_elf_phdr_memory_callback): Check start <
+ elf->maximum_size and end - start < minread.
+
2021-12-20 Mark Wielaard <mark@klomp.org>
* dwfl_segment_report_module.c (dwfl_segment_report_module): Move
/* Core file handling.
Copyright (C) 2008-2010, 2013, 2015 Red Hat, Inc.
+ Copyright (C) 2021 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
(void) more (*buffer_available);
/* If it's already on hand anyway, use as much as there is. */
- if (elf->map_address != NULL)
+ if (elf->map_address != NULL && start < elf->maximum_size)
(void) more (elf->maximum_size - start);
/* Make sure we don't look past the end of the actual file,
if (unlikely (start >= end))
return false;
+ if (end - start < minread)
+ return false;
+
if (elf->map_address != NULL)
{
void *contents = elf->map_address + elf->start_offset + start;