Rangi
a662cad7ce
Fix infinite loop when an aligned HRAM section cannot be placed ( #2064 )
2026-09-11 05:21:26 +02:00
Rangi
9c5e872f9c
First color of -c palettes with transparent pixels is transparent $8000, not unspecified $ffff
2026-09-10 16:41:32 -04:00
Rangi
25240e9fc0
Fix but deprecate an implicit transparent color #0
2026-09-10 19:32:00 +02:00
Rangi
8a6b1946e3
Parse inline palette specs after getting CLI palette size limit ( #2054 )
2026-09-10 18:54:24 +02:00
Max Freedom Pollard
631ef003e7
Avoid signed overflow in RGBLINK's +, -, and * ( #2060 )
...
RGBASM computes these with unsigned arithmetic and casts back, since
signed overflow is UB in C++, but RGBLINK's RPN evaluator used `int32_t`
directly, so `src/link/patch.cpp` tripped UBSan on lines 117, 121, and
124. Share the three operators through `opmath.cpp` so both evaluators
stay in step.
2026-09-07 16:15:07 -04:00
Rangi
fdd6cece30
Warn about signed 8-bit truncation for add sp, e8 and ld hl, sp + e8
2026-09-07 19:28:45 +02:00
Rangi
8988cdde46
Fix reversing images with fewer than 4 colors per palette
2026-09-03 13:39:24 +02:00
Rangi
b36028d1d1
Avoid unsigned overflow in INCBIN slice size check
2026-08-25 15:47:27 -04:00
Rangi
760cc4d464
Use PRIu8 for uint8_t
2026-08-25 15:06:31 -04:00
Rangi
eb2b7c1842
A 1GB ROM does not have "more than 65536 banks"
2026-08-25 15:02:44 -04:00
Rangi
a2c52caca2
Disallow NUL characters in section names and assertion messages
...
Allowing these in object files would lose anything after the '\0'
when RGBLINK reads the object.
2026-08-22 19:51:03 -04:00
Rangi
21a4b85a4f
Fix STRFMT stopping at NUL characters in format spec strings
2026-08-22 19:23:49 -04:00
Rangi
9fa5058add
Correct error message for macro arg \<-INT_MIN>
2026-08-22 19:02:23 -04:00
Rangi
e287ee2724
Fix C++ UB from negating INT_MIN with macro shift INT_MIN
2026-08-22 18:48:36 -04:00
Rangi
0888600cb7
Avoid OOM allocation error from invalid too-high bank numbers
2026-08-22 18:31:26 -04:00
Rangi
8bc7de35f9
Prevent SECTION FRAGMENT combined sizes from overflowing their uint16_t size
2026-08-22 18:24:17 -04:00
Rangi
ed0a2d1075
Fix infinite loop when a symbol name in an invalid object file starts with an invalid UTF-8 byte like 0xC0
2026-08-22 18:06:32 -04:00
ISSOtm
d9003f633a
Allow the CMake user to provide their own version string
...
This will be useful for downstream packagers, as well as rgbds-live
2026-08-15 20:25:35 +02:00
Rangi
ca2b8e4cde
Support the COLUMNS environment variable for help/usage output
2026-07-24 14:46:05 +02:00
Rangi
80c8e77b19
Fixed-point FMOD and LOG explicitly return 0 for some invalid inputs
...
This is consistent with `fix_Div`'s explicit error handling,
and does not rely on subtle C/C++ `fmod` or `log` IEEE 754 behavior.
2026-07-23 00:38:44 -04:00
Rangi
604c69e048
Fix palette-packing decant logic to avoid UB from invalid iterator ( #2031 )
...
The "Iterate through the component's color sets, and transfer them"
logic shifted `from.begin()`, which would make subsequent `std::advance`
calls go past `_assigned.end()` and cause UB. This rewrite uses absolute
numeric indexes into `_assigned` to avoid that potential problem.
I haven't been able to craft a test case that actually *reaches*
that piece of logic, and I suspect that it's unreachable given how
we sort and process color sets before decanting, but cannot prove
that; so it stays in. (Maybe if we added 4bpp 16-colors-per-palette
support, it would become reachable?)
2026-07-22 23:48:02 -04:00
Rangi
ec5e6cbabb
Handle -Wtruncation for link-time jr values
...
Fixes #2028
2026-07-21 14:51:58 -04:00
Rangi
50678d0942
Use _fseeki64/_ftelli64 on Windows since fseek/fell are limited by 32-bit long
2026-07-21 14:38:14 -04:00
Rangi
c691ec6607
Use std::optional<uint64_t> instead of long with a special -1 sentinel for seekSize
2026-07-21 14:31:05 -04:00
Rangi
9cbfec30c7
Avoid redundant "Unexpected text" error message after "Unknown" error
2026-07-21 13:54:11 -04:00
Rangi
9def9c9aa8
Fix an SDAS object error message to use the valid section name variable
2026-07-21 13:41:53 -04:00
Rangi
ec43f06bd9
Fix handling of at-files containing -- followed by positional arguments
2026-07-21 13:35:39 -04:00
Rangi
106ec399d5
Fix reading value of relocations symbol/section index from SDAS objects
2026-07-21 13:14:35 -04:00
Rangi
d9c0d37fd5
Explicitly allow JR offsets to wrap around in RGBLINK
...
This reverts commit f27a8132d9 .
2026-07-20 19:23:11 -04:00
Rangi
c0e2f8340b
Output negative values with correct with in .sym files
2026-07-20 00:09:06 -04:00
Rangi
8883251bf9
Avoid UB from FileStackNodeType(type) on an invalid type
2026-07-20 00:06:09 -04:00
Rangi
f27a8132d9
Avoid truncating too-large JR offset from an invalid object file
2026-07-20 00:02:39 -04:00
Rangi
0af28de791
Fix assertion failure on nonzero base palette ID without an attribute map or palette map
...
Also fix palette map IDs to wrap at 256, not at 8 like attributes
2026-07-19 23:59:38 -04:00
Rangi
8d2275dc48
Use rpnErrorAt wrapper to ensure setting isError on all RPN errors
...
Two possible RPN errors were missing `isError = true;`
2026-07-19 23:45:45 -04:00
Rangi
7e11ab4d8f
uint16_t tileIdx type matches options.baseTileIDs
...
Tile IDs wrap at 8 bits, but that's handled by `uint8_t tileID`
2026-07-19 23:33:01 -04:00
Rangi
e84bcf83b4
Use Procedure concept to type-check decantOn lambda
2026-07-15 23:27:08 -04:00
Rangi
57c9bab3a5
Addresses are 16-bit in .map files, consistent with .sym files
2026-07-15 22:59:50 -04:00
Rangi
4ada3e85d8
Avoid overflow for very large ROMs (e.g. TPP1)
2026-07-15 22:57:25 -04:00
Rangi
ba4a7f2e6a
Explicitly assume what was verified earlier by readSection
2026-07-15 22:56:43 -04:00
Rangi
b0948566bb
Fail-safe treat 16-bit alignment as a fixed address even in RGBLINK
...
RGBASM does this itself, so should not output sections with 16-bit
alignment, but an invalid object file could otherwise cause
`getPlacement` to infinitely loop.
2026-07-15 22:46:57 -04:00
Rangi
5aa7067876
Comment on how overflow to 0 is explicitly allowed for tile and palette IDs
2026-07-15 22:28:08 -04:00
Rangi
dff176791c
Correct grammar "is" vs "are" in RGBGFX reverse mode error messages
2026-07-14 11:29:30 -04:00
Rangi
07f5969005
Consistency check the palette map, not just the attribute map
2026-07-14 11:27:41 -04:00
Rangi
d61c0561c1
Correct condition to completely print both palettes and options.palSpec
2026-07-14 11:23:03 -04:00
Rangi
b13b0c8eb8
Fix the same shifting UB for SDAS objects as for RGBDS ones
2026-07-14 11:13:30 -04:00
Rangi
1ed22cc518
Mask blue for consistency (avoids transparent bit bugs)
2026-07-14 10:34:27 -04:00
Rangi
9a15b723f2
Format CGB colors in error/verbose messages as "GB:rr,gg,bb"
...
These should be more debuggable than packed "$xxxx" format.
2026-07-14 10:34:27 -04:00
Rangi
7e2a3491a5
Encapsulate fseek+ftell idiom in seekSize
...
This allows a single check for the return value of `seekSize`
to verify all three `fseek`+`ftell`+`fseek` calls.
2026-07-14 01:32:18 -04:00
Rangi
e7855ea1b8
Fix reverse mode with -s/--palette-size too small for the tile data
2026-07-14 01:11:11 -04:00
Rangi
19e60d9864
Fix large ds in linker script overflowing the PC
2026-07-14 00:42:42 -04:00