Menu

#18 Infinite loop in classes/codepage.cc

v1.0_(example)
closed
None
5
2020-08-22
2020-03-31
magiblot 1
No

When running Setedit in a tty, the program gets stuck in the following loop:

../classes/codepage.cc

   1851         // Adjust values found in source but not in dest (look for similars)
   1852         for (i=1; i<256; i++)                                               
   1853            {                                                                
   1854             unsigned val=toCode[i];                                         
   1855             if (fromCode[val])                                              
   1856                continue;                                                    
  >1857             while (!fromCode[val])                                          
   1858               { // Find an equivalent for val                               
   1859                if (val<256)                                                 
   1860                   val=Similar[val];                                         
   1861                else                                                         
   1862                   val=Similar2[val-256];                                    
   1863               }                                                             
   1864             fromCode[toCode[i]]=fromCode[val];                              
   1865            }

val is 112 and Similar[val] is also 112, so the loop never ends.

Discussion

  • magiblot 1

    magiblot 1 - 2020-03-31

    Okay, it was my fault for using a broken console font.

    Feel free to close this ticket.

     

    Last edit: magiblot 1 2020-03-31
  • Salvador Eduardo Tropea

    Ok. If you have more information to help detect the broken situation and avoid the hang let me know.

     
  • Salvador Eduardo Tropea

    • status: open --> closed
    • assigned_to: Salvador Eduardo Tropea
     

Log in to post a comment.