#79 Hang caused by clicking backspace with single neg number

closed-fixed
nobody
gui (32)
7
2012-10-13
2011-03-31
tjbp
No

Explicitly entering a negative number will cause an (infinite?) hang when backspace is clicked. For example, if the number -369 is entered (3, 6, 9, +/-), then the 6 and 9 are correctly removed by backspace, but the final -3 will cause the hang. Decimal points are also correctly removed - so it seems the problem is related to the number of characters rather than the actual value of the number.

If the number is the product of a sum (eg. 2 - 5), then the backspace correctly turns the -3 into zero.

Discussion

  • Ahmed Moody

    Ahmed Moody - 2011-09-15

    I've found the fix but i don't know how to submit it
    i'm a beginner

    in display.c :
    in display_result_backspace(int number_base_status) :

    else if ((strlen(current_entry) == 2) && (*current_entry == '-')) current_entry = "0\0";

    should be changed to :

    else if ((strlen(current_entry) == 2) && (*current_entry == '-')) strcpy(current_entry, "0\0");

     
  • Ahmed Moody

    Ahmed Moody - 2011-09-17

    EDIT :

    should be changed to :

    else if ((strlen(current_entry) == 2) && (*current_entry == '-'))
    strcpy(current_entry, "0");

    (no need for null termination then)

     
  • Simon

    Simon - 2012-09-24
    • priority: 5 --> 7
     
  • Simon

    Simon - 2012-10-13
    • status: open --> closed-fixed
     
  • Simon

    Simon - 2012-10-13

    Thanks for your bug report. Your proposed fix is correct and I have applied it to current SVN. It will be part of upcoming version 2.0. best

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks