Commit 651ba914 authored by mifi's avatar mifi
Browse files

- added patch to fix crash in load_image on corrupt elf file or out of memory.

(thanks to Øyvind Harboe for the patch)

git-svn-id: svn://svn.berlios.de/openocd/trunk@274 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 06f33996
......@@ -1778,6 +1778,11 @@ int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char
for (i = 0; i < image.num_sections; i++)
{
buffer = malloc(image.sections[i].size);
if (buffer==NULL)
{
command_print(cmd_ctx, "error allocating buffer for section (%d bytes)", image.sections[i].size);
break;
}
if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
{
ERROR("image_read_section failed with error code: %i", retval);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment