Crash with cMenuEditStrItem in vdr-1.5.9

Message ID 46FDFFD3.5040505@gmx.de
State New
Headers

Commit Message

Christian Wieninger Sept. 29, 2007, 7:33 a.m. UTC
  Hi,

me and Rolf Ahrenberg noticed that there seems to be a problem with 
cMenuEditStrItem in vdr-1.5.9. To reproduce it just call the timer edit 
menu and hit 'left' on the directory item or any other cMenuEditStrItem 
object. The following patch should fix this:


It happens here that pos is -1.

Strange that the old code of previous vdr versions

                 if (!insert && isalpha(value[pos]))
                    uppercase = isupper(value[pos]);

had no problem there.

BR,

Christian
  

Patch

--- vdr-1.5.9/menuitems.c       2007-08-17 15:48:07.000000000 +0200
+++ VDR/menuitems.c     2007-09-29 09:02:12.000000000 +0200
@@ -500,7 +500,7 @@ 
                        pos--;
                     newchar = true;
                     }
-                 if (!insert && Utf8is(alpha, valueUtf8[pos]))
+                 if (pos >= 0 && !insert && Utf8is(alpha, valueUtf8[pos]))
                     uppercase = Utf8is(upper, valueUtf8[pos]);
                  break;
     case kRight|k_Repeat: