jdah / jdh-8

An 8-bit minicomputer with a fully custom architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible memory leak

Kylogias opened this issue · comments

There is a possible memory leak in the load function of emu/libemu.c where the file may be bigger than 32K (the size of ROM) or even 64K (the size of the entire memory). This can leave to corrupted data when, for example, the screen is reading from memory, or another process modifies memory, or even the PROGRAM ITSELF modifies memory as it'll have an unknown size when assembled, thus you may read into/from memory that has program code

I just looked at the code and it looks like it doesn't.
emu_memcpy is protected against writing out of memory by the ppeek function in common/jdh8.h where this lines appears :

    if (addr >= ADDR_MB) {
        return &((u8 *) state->special.raw)[addr - ADDR_MB];

Here I think the only thing that could happen is that the memory would be overwritten.

commented

Not a memory leak, but this should warn. Fixed in b5f7827, thanks!