GNOME Bugzilla – Bug 739457
Some errors not detected for GIMP_PDB_COLOR arguments
Last modified: 2014-11-30 17:35:07 UTC
Created attachment 289754 [details] [review] Patch to type-check GIMP-PDB-COLOR arguments Description: When passing arguments of type GIMP_PDB_COLOR to PDB procedures (such as 'gimp-context-set-foreground'), the color specification should be either a string containing a CSS color or a list of three numbers (for the red, green, and blue components). Script-fu properly tests that the argument is either a string or a 3-element list but in the case of a list, it does not verify that the elements of the list are numbers. Steps to Reproduce: 1) Open the Script-fu console 2) Enter the command: (gimp-context-set-foreground '(x y z)) Result: The foreground color gets set to white. Apparently the memory address of the symbols are treated as the list elements (and gets clamped to "255"). Expected result: Script-fu should detect that the list argument contains non-numbers and should generate an error. Note: Current behavior does not interfere with proper functioning of valid scripts. It is only that errors that should be detected are not. Attached patch was made against GIMP 2.8.14. I am not sure if the error message sent during DEBUG_MARSHALL output is sufficient. It currently sends "COLOR list contains non-numbers" but does not echo the offending argument (to do so would require converting the Scheme expression to a string).
Fixed in master and gimp-2-8. The patch contained tabs instead of spaces, please try to avoid that. commit dad54b67c1267db6b294004a5c2900a505558785 Author: Saul Goode <saul@crazyauntgail.com> Date: Fri Oct 31 12:13:07 2014 -0400 Bug 739457 - Some errors not detected for GIMP_PDB_COLOR arguments Check that all 3 array elements are numbers- (cherry picked from commit d03b33f1d90991623fd1848c7a2d2a61900d4396) plug-ins/script-fu/scheme-wrapper.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)