Bug #317009 --> Thunderbird incorrectly decodes =00 in quoted-printable attachments as 0x20, not NULL (regression by bug 243199)
leads to inability to open certain PDF attachments. patch by bienvenu a=mscott for 1.8.0.x. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_0_BRANCH@188599 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -118,7 +118,17 @@ MimeEncrypted_parse_begin (MimeObject *obj)
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_BASE64))
|
||||
fn = &MimeB64DecoderInit;
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_QUOTED_PRINTABLE))
|
||||
fn = &MimeQPDecoderInit;
|
||||
{
|
||||
enc->decoder_data =
|
||||
MimeQPDecoderInit (/* The (int (*) ...) cast is to turn the `void' argument
|
||||
into `MimeObject'. */
|
||||
((nsresult (*) (const char *, PRInt32, void *))
|
||||
((MimeEncryptedClass *)obj->clazz)->parse_decoded_buffer),
|
||||
obj);
|
||||
|
||||
if (!enc->decoder_data)
|
||||
return MIME_OUT_OF_MEMORY;
|
||||
}
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE) ||
|
||||
!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE2) ||
|
||||
!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE3) ||
|
||||
|
||||
@@ -1964,7 +1964,13 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
|
||||
else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_BASE64))
|
||||
fn = &MimeB64DecoderInit;
|
||||
else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_QUOTED_PRINTABLE))
|
||||
fn = &MimeQPDecoderInit;
|
||||
{
|
||||
mdd->decoder_data = MimeQPDecoderInit (/* The (nsresult (*) ...) cast is to turn the `void' argument into `MimeObject'. */
|
||||
((nsresult (*) (const char *, PRInt32, void *))
|
||||
dummy_file_write), mdd->tmpFileStream);
|
||||
if (!mdd->decoder_data)
|
||||
return MIME_OUT_OF_MEMORY;
|
||||
}
|
||||
else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE) ||
|
||||
!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE2) ||
|
||||
!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_UUENCODE3) ||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "plstr.h"
|
||||
#include "prlog.h"
|
||||
#include "prprf.h"
|
||||
#include "mimeobj.h"
|
||||
|
||||
typedef enum mime_encoding {
|
||||
mime_Base64, mime_QuotedPrintable, mime_uuencode, mime_yencode
|
||||
@@ -63,6 +64,7 @@ struct MimeDecoderData {
|
||||
char *line_buffer;
|
||||
int line_buffer_size;
|
||||
|
||||
MimeObject *objectToDecode; // might be null, only used for QP currently
|
||||
/* Where to write the decoded data */
|
||||
nsresult (*write_buffer) (const char *buf, PRInt32 size, void *closure);
|
||||
void *closure;
|
||||
@@ -176,7 +178,9 @@ mime_decode_qp_buffer (MimeDecoderData *data, const char *buffer, PRInt32 length
|
||||
continue;
|
||||
}
|
||||
/* treat null bytes as spaces per bug 243199 comment 7 */
|
||||
*out++ = c ? (char) c : ' ';
|
||||
*out++ = c || (data->objectToDecode &&
|
||||
data->objectToDecode->options->format_out != nsMimeOutput::nsMimeMessageBodyDisplay)
|
||||
? (char) c : ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -797,9 +801,12 @@ MimeB64DecoderInit (nsresult (*output_fn) (const char *, PRInt32, void *),
|
||||
|
||||
MimeDecoderData *
|
||||
MimeQPDecoderInit (nsresult (*output_fn) (const char *, PRInt32, void *),
|
||||
void *closure)
|
||||
void *closure, MimeObject *object)
|
||||
{
|
||||
return mime_decoder_init (mime_QuotedPrintable, output_fn, closure);
|
||||
MimeDecoderData *retData = mime_decoder_init (mime_QuotedPrintable, output_fn, closure);
|
||||
if (retData)
|
||||
retData->objectToDecode = object;
|
||||
return retData;
|
||||
}
|
||||
|
||||
MimeDecoderData *
|
||||
|
||||
@@ -124,7 +124,10 @@ MimeLeaf_parse_begin (MimeObject *obj)
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_BASE64))
|
||||
fn = &MimeB64DecoderInit;
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_QUOTED_PRINTABLE))
|
||||
fn = &MimeQPDecoderInit;
|
||||
leaf->decoder_data =
|
||||
MimeQPDecoderInit(((nsresult (*) (const char *, PRInt32, void *))
|
||||
((MimeLeafClass *)obj->clazz)->parse_decoded_buffer),
|
||||
obj, obj);
|
||||
else if (!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE) ||
|
||||
!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE2) ||
|
||||
!nsCRT::strcasecmp(obj->encoding, ENCODING_UUENCODE3) ||
|
||||
|
||||
@@ -395,7 +395,15 @@ MimeMultipartSigned_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
||||
else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_BASE64))
|
||||
fn = &MimeB64DecoderInit;
|
||||
else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_QUOTED_PRINTABLE))
|
||||
fn = &MimeQPDecoderInit;
|
||||
{
|
||||
sig->sig_decoder_data =
|
||||
MimeQPDecoderInit (((nsresult (*) (const char *, PRInt32, void *))
|
||||
(((MimeMultipartSignedClass *) obj->clazz)
|
||||
->crypto_signature_hash)),
|
||||
sig->crypto_closure);
|
||||
if (!sig->sig_decoder_data)
|
||||
return MIME_OUT_OF_MEMORY;
|
||||
}
|
||||
else if (!nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE) ||
|
||||
!nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE2) ||
|
||||
!nsCRT::strcasecmp(encoding.get(), ENCODING_UUENCODE3) ||
|
||||
|
||||
@@ -56,17 +56,17 @@
|
||||
typedef struct MimeDecoderData MimeDecoderData;
|
||||
typedef struct MimeEncoderData MimeEncoderData;
|
||||
|
||||
struct MimeObject;
|
||||
|
||||
|
||||
/* functions for creating that opaque data.
|
||||
*/
|
||||
MimeDecoderData *MimeB64DecoderInit(nsresult (*output_fn) (const char *buf,
|
||||
PRInt32 size,
|
||||
void *closure),
|
||||
void *closure);
|
||||
MimeDecoderData *MimeQPDecoderInit (nsresult (*output_fn) (const char *buf,
|
||||
PRInt32 size,
|
||||
void *closure),
|
||||
MimeDecoderData *MimeB64DecoderInit(nsresult (*output_fn) (const char *buf,PRInt32 size, void *closure),
|
||||
void *closure);
|
||||
|
||||
MimeDecoderData *MimeQPDecoderInit (nsresult (*output_fn) (const char *buf, PRInt32 size, void *closure),
|
||||
void *closure, MimeObject *object = nsnull);
|
||||
|
||||
MimeDecoderData *MimeUUDecoderInit (nsresult (*output_fn) (const char *buf,
|
||||
PRInt32 size,
|
||||
void *closure),
|
||||
|
||||
Reference in New Issue
Block a user