Package: release.debian.org  
User: release.debian....@packages.debian.org                     
Usertags: unblock
Severity: normal 

Hi,

I would like to ask if you could unblock a fix for an important crash in 
calligrasheets, triggered by entering some special characters in formula (like 
" or !) :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702824

Upsteam already made a simple patch for it (about 15 lines are modified) :
http://anonscm.debian.org/gitweb/?p=pkg-kde/kde-std/calligra.git;a=blob;f=debian/patches/fix_tokenizing_of_invalid_formulas.patch;h=9b70ec9d075bc84a4de47007ba56a371c1ea165c;hb=85b3f71e7dc4b3c31a8c88cda9c322510fcc5390

You can find the debdiff attached to this email.

Regards,

Adrien Grellier
diff -Nru calligra-2.4.4/debian/changelog calligra-2.4.4/debian/changelog
--- calligra-2.4.4/debian/changelog	2013-02-20 18:48:45.000000000 +0100
+++ calligra-2.4.4/debian/changelog	2013-03-15 17:51:19.000000000 +0100
@@ -1,3 +1,11 @@
+calligra (1:2.4.4-3) UNRELEASED; urgency=low
+
+  * import patch fix_tokenizing_of_invalid_formulas.patch from upstream
+    (Closes: #702824). It prevent a important crash when entering some special
+    characters in formula.
+
+ -- Adrien Grellier <adrien.grell...@laposte.net>  Fri, 15 Mar 2013 17:49:12 +0100
+
 calligra (1:2.4.4-2) unstable; urgency=low
 
   [ Lisandro Damián Nicanor Pérez Meyer ]
diff -Nru calligra-2.4.4/debian/patches/fix_tokenizing_of_invalid_formulas.patch calligra-2.4.4/debian/patches/fix_tokenizing_of_invalid_formulas.patch
--- calligra-2.4.4/debian/patches/fix_tokenizing_of_invalid_formulas.patch	1970-01-01 01:00:00.000000000 +0100
+++ calligra-2.4.4/debian/patches/fix_tokenizing_of_invalid_formulas.patch	2013-03-15 17:51:25.000000000 +0100
@@ -0,0 +1,53 @@
+--- a/sheets/Formula.cpp
++++ b/sheets/Formula.cpp
+@@ -656,7 +656,8 @@
+     tokens.reserve(50);
+ 
+     ++data;
+-    const QChar *start = data;
++    const QChar * const start = data;
++    const QChar * const end = start + expr.length();
+     const QChar *tokenStart = data;
+     const QChar *cellStart = data;
+ 
+@@ -667,9 +668,9 @@
+     QString token(length, QChar());
+     token.reserve(length); // needed to not realloc at the resize at the end
+     QChar * out = token.data();
+-    QChar * outStart = token.data();
+-
+-    while (state != Finish) {
++    QChar * const outStart = token.data();
++
++    while (state != Finish && data < end) {
+         switch (state) {
+         case Start:
+             tokenStart = data;
+@@ -1060,7 +1061,7 @@
+     }
+ 
+     // parse error if any text remains
+-    if (!data->isNull())  {
++    if (data+1 < end)  {
+         tokens.append(Token(Token::Unknown, expr.mid(tokenStart - start), tokenStart - start));
+         parseError = true;
+     }
+
+--- a/sheets/tests/TestFormula.cpp
++++ b/sheets/tests/TestFormula.cpp
+@@ -177,9 +177,13 @@
+     // invalid formulas, can't be parsed correctly
+     CHECK_TOKENIZE("+1.23E", QString());
+ 
++    // incomplete formulas
++    CHECK_TOKENIZE("COMPARE(\"", "xo");
++    CHECK_TOKENIZE("SHEETS(Sheet2!", "");
++
+     // empty parameter
+     CHECK_TOKENIZE("IF(A1;A2;)", "xococoo");
+-    CHECK_TOKENIZE("=OFFSET(Sheet2'!B7;0;0)", "");
++    CHECK_TOKENIZE("OFFSET(Sheet2'!B7;0;0)", "");
+ 
+     // function cascade
+     CHECK_TOKENIZE("SUM(ABS(-1);ABS(-1))", "xoxooiooxooioo");
+
diff -Nru calligra-2.4.4/debian/patches/series calligra-2.4.4/debian/patches/series
--- calligra-2.4.4/debian/patches/series	2013-02-20 17:58:53.000000000 +0100
+++ calligra-2.4.4/debian/patches/series	2013-03-15 17:51:35.000000000 +0100
@@ -1 +1,2 @@
 do_not_link_blas.diff
+fix_tokenizing_of_invalid_formulas.patch

Reply via email to