This bug was discovered by Claude Opus 5.5 and reproduced on Maxima Git commit c62924c (2026-09-26) with SBCL 2.2.9.
Where: src/plotcolors.lisp, PLOTCOLORP, RGB-COLOR
PLOTCOLORP and RGB-COLOR parse (subseq color 1 6), which is only five characters. So the sixth hex digit is never checked, and an invalid color is passed to gnuplot.
src/plotcolors.lisp as described under "Fix".tests/rtest_plotoptions.mac, at the end of the file.make check, or run_testsuite(share_tests=true); in ./maxima-local), and check that the change breaks no test. Failures that also occur without the change (a run on the unchanged build shows which) are pre-existing and can be ignored.* \#5487 A #rrggbb color with a bad last digit, such as "#00000g", is accepted to ChangeLog, under "Bug fixes for numbered bugs:".Fixed by commit [1a2b3c]., with the first six characters of the commit's SHA in the brackets (git rev-parse HEAD | cut -c1-6 prints them). SourceForge links this to the commit.set_plot_option([color,"#00000g"]);
Before the fix:
accepted: the options now contain [color,"#00000g"]
Correct result:
Wrong argument for plot option "color". Expecting a color but found "#00000g".
In src/plotcolors.lisp (PLOTCOLORP, line "(ignore-errors (parse-integer (subseq color 1 6) :radix 16)))"), replace
(= (length color) 7)
(ignore-errors (parse-integer (subseq color 1 6) :radix 16)))
with
(= (length color) 7)
(ignore-errors (parse-integer (subseq color 1 7) :radix 16)))
In src/plotcolors.lisp (RGB-COLOR, line "(ignore-errors (parse-integer (subseq color 1 6) :radix 16)))"), replace
(= (length color) 7)
(ignore-errors (parse-integer (subseq color 1 6) :radix 16)))
with
(= (length color) 7)
(ignore-errors (parse-integer (subseq color 1 7) :radix 16)))
Add these lines to tests/rtest_plotoptions.mac, separated from the tests before them by two empty lines:
/* Bug #5487: "A #rrggbb color with a bad last digit, such as "#00000g", is accepted" */
block ([r],
reset_plot_options (),
r: [errcatch (set_plot_option ([color, "#00000g"])),
(set_plot_option ([color, "#00000f"]), get_plot_option (color))],
set_plot_option ([color, blue, red, green, magenta, black, cyan]),
reset_plot_options (),
r);
[[], [color, "#00000f"]]$
plotcolors.lisp: check all six digits of #rrggbb colors
PLOTCOLORP and RGB-COLOR parsed (SUBSEQ COLOR 1 6), which leaves out the
last digit, so a color such as "#00000g" was accepted and passed to the
graphic program. Parse all six digits.
This fixes bug #5487.
Found and fixed by Claude Opus 5.5.
Diff: