shithub: rgbds

Download patch

ref: b6bf7ae6206ca0c755414679e311aed082fa4473
parent: dc96cc6d1e9295b05dbeaa88df70056400a94bea
author: ISSOtm <eldredhabert0@gmail.com>
date: Tue Nov 3 21:52:06 EST 2020

Fix RGBLINK incorrectly reading file stack nodes

This caused node IDs to mismatch, yielding possibly corrupted file stacks
Worst part is, the docs mentioned the reading order had to be reversed...

--- a/src/link/object.c
+++ b/src/link/object.c
@@ -497,7 +497,7 @@
 	if (!nodes[fileID].nodes)
 		err(1, "Failed to get memory for %s's nodes", fileName);
 	verbosePrint("Reading %u nodes...\n", nodes[fileID].nbNodes);
-	for (uint32_t i = 0; i < nodes[fileID].nbNodes; i++)
+	for (uint32_t i = nodes[fileID].nbNodes; i--; )
 		readFileStackNode(file, nodes[fileID].nodes, i, fileName);
 
 	/* This file's symbols, kept to link sections to them */