X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fcore.c;h=429bad6762dcbe606cb776f5f39e1eceefc4cfd0;hp=1bd09b444d9c392d08f6f097937039c9660e8d43;hb=9ab7636ce6276d222662be431a1e6be96d9d34c0;hpb=49e6c61bcc9a176119721c38004eca02b3e77f19 diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 1bd09b444d..429bad6762 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -636,7 +636,11 @@ int flash_write_unlock(struct target *target, struct image *image, LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); } - assert (run_address + run_size - 1 <= c->base + c->size - 1); + if (run_address + run_size - 1 > c->base + c->size - 1) + { + LOG_ERROR("The image is too big for the flash"); + return ERROR_FAIL; + } /* If we're applying any sector automagic, then pad this * (maybe-combined) segment to the end of its last sector.