BUG DESCRIPTION:----------------Error message: Scilab 6.0.0(GUI) has stopped working - close program. ERROR LOG:----------HOW TO REPRODUCE THE BUG:-------------------------a=input('How can this line cause Scilab 6.0.0 Beta to crash when pressing enter?:'); OTHER INFORMATION:------------------
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related or that one is blocking others.
Learn more.
I confirm this bug on my machine (linux 64bits - ubuntu 14.04) with 6.0.0-beta, while there is no problem with 5.5.1.
Antoine
PS: here is the error I got on the command line:
mymachine:scilab $ betascilab
Une erreur grave a été détectée par Scilab.
Votre instance va probablement se fermer inopinément.
Ce problème provient sûrement de vos pilotes de cartes graphiques à l'utilisation d'une fonctionnalité graphique dans Scilab.
Veuillez les mettre à jour et ré-essayer .
Vous pouvez rapporter un bug sur http://bugzilla.scilab.org/ avec :
un extrait de code qui reproduit le bug
le résultat de [a, b] = getdebuginfo()
les informations suivantes :
[mymachine:16495] Signal: Segmentation fault (11)
[mymachine:16495] Signal code: (128)
[mymachine:16495] Failing at address: (nil)
But you are right as stated in the comments on the codereview above, we need to protect a little the PROMPT_SIZE_MAX
A first correction could be to raise it to 1024 and protect the sci_prompt function to avoid setting the prompt to more characters.
The fix Adeline suggests is to first display the message then call a prompt
maybe a standard prompt for user input awaited could be a good solution
Suggestions:
-?>
?>>
Input>
But you are right as stated in the comments on the codereview above, we need to protect a little the PROMPT_SIZE_MAX
A first correction could be to raise it to 1024 and protect the sci_prompt function to avoid setting the prompt to more characters.
The fix Adeline suggests is to first display the message then call a prompt
maybe a standard prompt for user input awaited could be a good solution
Suggestions:
-?>
?>>
Input>
what do you think?
Thanks for the quick comment.
As I understand, the problem lies in "prompt.c" file, at the functions "SetTemporaryPrompt", which sets the pointer "temporaryPrompt" for the prompt message, and "C2F", which does the actual copy ("strcpy(Sci_Prompt, temporaryPrompt);"). Am I right ?
If we check for a string longer than 1024 chars when setting the prompt, should we return an error, avoid the copy completely or use strncpy() ?
I think the "input>" prompt string is more consistent with the other defined in "prompt.h" header ("SCIPROMPTDEBUG" and "SCIPROMPTBREAK"). But are we including it there (with "SCIPROMPTINPUT" define or something) ? If so, how to detect it is an input operation ?
Sorry for possibly bad English. I hope you understand my questions well.
now, all messages must take into account mprintf() limitations or requirements:
"%" character yields errors:
input("Required % of tin:", "string")
--> input("Required % of tin:", "string")
at line 36 of function input ( SCI\modules\io\macros\input.sci line 50 )
mprintf : Nombre erroné d'arguments d'entrée : Les données ne correspondent pas au format.
backslashes are parsed "à la C" and are eaten instead of being simply echoed: