vovoid / vsxu

Visual programming language; Real-time OpenGL graphics; Embeddable; GPL/LGPL Licensed; Audio/Music Visualizer; Animation tool
http://vsxu.com
Other
366 stars 59 forks source link

console commands, containing arguments with comma separated lists, cause the parser to segfault vsxu #148

Open TheMindVirus opened 10 years ago

TheMindVirus commented 10 years ago

File: (???vsxu_engine_command_parser_filepath???)

Possible Explanation There are certain commands in the VSXu engine which take in arguments which are comma separated lists of values. When the command is evaluated, the parser splits these commands using the comma delimiter.

However, when these commands are entered incorrectly, the parser cannot split the command string correctly, thus causing a segfault.

What Happens Normally The current behaviour for other incorrectly entered commands in the engine is to send back either "Invalid Command" or "alert fail= etc...". The engine sends no messages back if the command has the wrong number of arguments, but is still recognised as a command.

What Should Happen Normally If cparts[0](command name) is not recognised then: cmd_out->add_raw("Invalid Command"); If the command has been recognised but the number of arguments is incorrect then: cmd_out->add_raw("Invalid Syntax"); If any relevant sanity checks on the arguments fail then: cmd_out->add_raw("Invalid Argument(s)"); If the command succeeded, print out the command_ok messages and proceed. (this already happens.)

Known Affected Commands component_assign [macro name] [component],[component],[component] [x] [y] add_empty_macro [macro name] [x],[y] Other commands which use commas as delimiters for arguments (only when entered incorrectly)

Steps to Replicate

  1. Open vsxu_artiste
  2. Create an empty macro (right-click and select "create macro")
  3. Right-click the macro and select open/close (to open the macro)
  4. Add a colored_rectangle into the macro
  5. Click the bottom of the screen to open the console
  6. Click outside the macro to set the console to desktop_local
  7. Click the console and enter command "stop" to stop sequence time
  8. Enter command "component_assign colored_rectangle 1 1" OR alternatively "component_assign desktop_local colored_rectangle 1 1" VSXu will crash with segfault (you can see this if you launched from terminal) WHEREAS this command should work "component_assign desktop_local empty.colored_rectangle 1 1"
jaw commented 10 years ago

add_empty_macro isn't an engine command, it's internal to artiste, so not doing much there.

jaw commented 10 years ago

Leaving this open as you'll find more of these ;)

TheMindVirus commented 10 years ago

To write the visual fader program with Safari, I'll need something similar to add_empty_macro to load 2 states at the same time. Which command should I use to add a macro to vsxu_server?

jaw commented 10 years ago

macro_create [macro_name] [pos_x] [pos_y] [size]