Package: kaya Version: 0.4.2-2 Severity: grave Tags: patch Justification: causes non-serious data loss
0.4.2 contains a few data loss / data corruption bugs that are fixed upstream in 0.4.3. The attached patch fixes these bugs, as well as a compiler error where valid code would not compile. In order from most serious to least, the bugs are: rts/VMState.cc: fixes memory allocation bug which can cause hard-to-trace crashes. libs/my_inter.cc: fixes data corruption bug where values returned from prepared queries in MySQL contain NULLs stdlib/Mime.k: fixes bug with processing of form fields in file upload forms stdlib/Regex.k: fixes bug with Regex splitting of strings where the delimiter terminates the string compiler/LambdaLift.hs: fixes bug with for loops and lambda functions Thanks -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.18 (SMP w/1 CPU core) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages kaya depends on: ii g++-4.2 4.2.3-2 The GNU C++ compiler ii libc6 2.7-9 GNU C Library: Shared libraries ii libgc-dev 1:6.8-1.1 conservative garbage collector for ii libgc1c2 1:6.8-1.1 conservative garbage collector for ii libgcc1 1:4.3-20080227-1 GCC support library ii libgcrypt11 1.4.0-3 LGPL Crypto library - runtime libr ii libgcrypt11-dev 1.4.0-3 LGPL Crypto library - development ii libgmp3c2 2:4.2.1+dfsg-5 Multiprecision arithmetic library ii libgnutls-dev 2.2.2-1 the GNU TLS library - development ii libncurses5 5.6+20080203-1 Shared libraries for terminal hand ii libpcre3 7.6-2 Perl 5 Compatible Regular Expressi ii libpcre3-dev 7.6-2 Perl 5 Compatible Regular Expressi ii libreadline5 5.2-3 GNU readline and history libraries ii libstdc++6 4.3-20080227-1 The GNU Standard C++ Library v3 ii zlib1g 1:1.2.3.3.dfsg-11 compression library - runtime ii zlib1g-dev 1:1.2.3.3.dfsg-11 compression library - development kaya recommends no packages. -- no debconf information
diff -rN -u old-kaya/compiler/LambdaLift.hs new-kaya/compiler/LambdaLift.hs --- old-kaya/compiler/LambdaLift.hs 2008-08-18 10:04:38.000000000 +0100 +++ new-kaya/compiler/LambdaLift.hs 2008-08-18 10:04:38.000000000 +0100 @@ -83,7 +83,7 @@ let (defs'',e2') = lift' defs' locs e2 in (defs'',DoWhile e1' e2') lift' defs locs (For i nm j lval e1 e2) = - let (defs',e1') = lift' defs locs e1 in + let (defs',e1') = lift' defs (fakevars++locs) e1 in let (defs'',e2') = lift' defs' (fakevars++locs) e2 in let (defs''',lval') = liftlval defs'' locs lval in (defs''',For i nm j lval' e1' e2') diff -rN -u old-kaya/libs/my_inter.cc new-kaya/libs/my_inter.cc --- old-kaya/libs/my_inter.cc 2008-08-18 10:04:38.000000000 +0100 +++ new-kaya/libs/my_inter.cc 2008-08-18 10:04:38.000000000 +0100 @@ -289,7 +289,11 @@ for(int j = 0; j<numflds; j++) { KayaValue pv,fld; - pv = KayaString(KSTRING((char*)rbind[i].buffer)); + if (rnull[j]) { + pv = KayaString(L""); + } else { + pv = KayaString(KSTRING((char*)rbind[j].buffer)); + } fld = KayaUnion(0,1); KayaUnionSetArg(fld,0,pv); KayaArrayPush(row,fld); diff -rN -u old-kaya/rts/VMState.cc new-kaya/rts/VMState.cc --- old-kaya/rts/VMState.cc 2008-08-18 10:04:38.000000000 +0100 +++ new-kaya/rts/VMState.cc 2008-08-18 10:04:38.000000000 +0100 @@ -28,7 +28,7 @@ void initFunMap(kint sz, kint fmhash) { - func* funcs = (func*)malloc(sizeof(func)*sz); + func* funcs = (func*)GC_MALLOC_UNCOLLECTABLE(sizeof(func)*sz); m_funmap[0] = funcs; m_funmapsize = sz; m_funmaphash = fmhash; diff -rN -u old-kaya/stdlib/Mime.k new-kaya/stdlib/Mime.k --- old-kaya/stdlib/Mime.k 2008-08-18 10:04:38.000000000 +0100 +++ new-kaya/stdlib/Mime.k 2008-08-18 10:04:38.000000000 +0100 @@ -135,7 +135,13 @@ pop(bstack); } if (fname == "") { - push(mimeobjs,Mime(copy(blockname),copy(ctype),MimeString(copy(content)))); + if (substr(content,-2,2) == "\r\n") { + push(mimeobjs,Mime(copy(blockname),copy(ctype),MimeString(substr(content,0,length(content)-2)))); + } else if (substr(content,-1,1) == "\n" || substr(content,-1,1) == "\r") { + push(mimeobjs,Mime(copy(blockname),copy(ctype),MimeString(substr(content,0,length(content)-1)))); + } else { + push(mimeobjs,Mime(copy(blockname),copy(ctype),MimeString(copy(content)))); + } } else { push(mimeobjs,Mime(copy(blockname),copy(ctype),MimeFile(copy(fname),copy(tmpname)))); close(mfh); @@ -148,7 +154,7 @@ leavestate = DecodeBody; } else { if (fname == "") { - trim(line); + // trim(line); content += line; } else { // binary safe (last \r\n is a delimiter, not content... complicated) diff -rN -u old-kaya/stdlib/Regex.k new-kaya/stdlib/Regex.k --- old-kaya/stdlib/Regex.k 2008-08-18 10:04:38.000000000 +0100 +++ new-kaya/stdlib/Regex.k 2008-08-18 10:04:38.000000000 +0100 @@ -317,10 +317,14 @@ } limit--; if (limit == 0) { - push(strs,str); + if (allowempty || str != "") { + push(strs,str); + } break; } // stop matching - | noMatch() -> push(strs,str); + | noMatch() -> if (allowempty || str != "") { + push(strs,str); + } break; // Stop matching } return strs;