]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
bugfix: loop for ortgmem_type should be for the number of MAX_RTG_BOARDS
authorDimitris Panokostas <dimitris.panokostas@norce.io>
Fri, 16 Dec 2022 08:10:39 +0000 (09:10 +0100)
committerDimitris Panokostas <dimitris.panokostas@norce.io>
Fri, 16 Dec 2022 08:10:39 +0000 (09:10 +0100)
ortgmem_type is defined having a size of MAX_RTG_BOARDS, but the loop uses MAX_RAM_BOARDS when going through it.

Since MAX_RAM_BOARDS and MAX_RTG_BOARDS happen to be the same (4) in WinUAE, it didn't have any effect. However, if those happen to be different (like in Amiberry, where MAX_RTG_BOARDS is set to 1), then this will cause undefined behavior after the first iteration.

od-win32/mman.cpp

index 64eb6d4de058deadbf107a562ebd15f3b85f191d..d1d14a82ab6853e2b83b48fe48b40ee0eb7164cd 100644 (file)
@@ -614,7 +614,7 @@ void free_shm (void)
 {
        resetmem (true);
        clear_shm ();
-       for (int i = 0; i < MAX_RAM_BOARDS; i++) {
+       for (int i = 0; i < MAX_RTG_BOARDS; i++) {
                ortgmem_type[i] = -1;
        }
 }