[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [Bug 65615] kmail crashes with message: kmail: FATAL: q codec lies
From:       Stephan Kulow <coolo () kde ! org>
Date:       2003-10-30 14:16:19
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=65615     
coolo@kde.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From coolo@kde.org  2003-10-30 15:16 -------
Subject: kdepim/libkdenetwork

CVS commit by coolo: 

I think, I found the reason for "FATAL: q codec lies about it's maxDecodedSizeFor"
- well, the q coded lied about it's maxDecodedSizeFor. 
It took a diploma to figure that factories - but I managed to :)
CCMAIL: 65615-done@bugs.kde.org
CCMAIL: mutz@kde.org

Marc: I think, the real bug (and the fact it happened that often on ppc) was
in kmime_util.cpp, where one too many assumption about the signedness of char
happens ;(


  M +29 -5     kmime_codec_qp.cpp   1.13
  M +4 -20     kmime_codec_qp.h   1.5


--- kdepim/libkdenetwork/kmime_codec_qp.cpp  #1.12:1.13
@@ -190,4 +190,18 @@ public:
 };
 
+// this doesn't access any member variables, so it can be defined static
+// but then we can't call it from virtual functions
+static int QuotedPrintableDecoder_maxDecodedSizeFor( int insize, bool withCRLF ) {
+  // all chars unencoded:
+  int result = insize;
+  // but maybe all of them are \n and we need to make them \r\n :-o
+  if ( withCRLF )
+    result += insize;
+
+  // there might be an accu plus escape
+  result += 2;
+
+  return result;
+}
 
 Encoder * QuotedPrintableCodec::makeEncoder( bool withCRLF ) const {
@@ -199,4 +213,8 @@ Decoder * QuotedPrintableCodec::makeDeco
 }
 
+int QuotedPrintableCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const {
+    return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF);
+}
+
 Encoder * Rfc2047QEncodingCodec::makeEncoder( bool withCRLF ) const {
   return new Rfc2047QEncodingEncoder( withCRLF );
@@ -207,4 +225,8 @@ Decoder * Rfc2047QEncodingCodec::makeDec
 }
 
+int Rfc2047QEncodingCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const {
+    return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF);
+}
+
 Encoder * Rfc2231EncodingCodec::makeEncoder( bool withCRLF ) const {
   return new Rfc2047QEncodingEncoder( withCRLF, '%' );
@@ -215,4 +237,7 @@ Decoder * Rfc2231EncodingCodec::makeDeco
 }
 
+int Rfc2231EncodingCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const {
+    return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF);
+}
 
   /********************************************************/

--- kdepim/libkdenetwork/kmime_codec_qp.h  #1.4:1.5
@@ -59,13 +59,5 @@ public:
   }
 
-  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const {
-    // all chars unencoded:
-    int result = insize;
-    // but maybe all of them are \n and we need to make them \r\n :-o
-    if ( withCRLF )
-      result += insize;
-
-    return result;
-  }
+  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
 
   Encoder * makeEncoder( bool withCRLF=false ) const;
@@ -93,9 +85,5 @@ public:
   }
 
-  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const {
-    (void)withCRLF; // keep compiler happy
-    // equally simple: nothing is encoded at all, so:
-    return insize;
-  }
+  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
 
   Encoder * makeEncoder( bool withCRLF=false ) const;
@@ -122,9 +110,5 @@ public:
   }
 
-  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const {
-    (void)withCRLF; // keep compiler happy
-    // same as for "q" encoding:
-    return insize;
-  }
+  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
 
   Encoder * makeEncoder( bool withCRLF=false ) const;
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic