View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001022SOGoSOPEpublic2010-12-01 13:582011-05-10 15:58
Assigned Toludovic 
PlatformOSOS Version
Product Version1.3.4 
Target VersionFixed in Version1.3.8 
Summary0001022: specific mail crashes sogo in SOPE NGMimeRFC822DateHeaderFieldParser
Descriptionattached mail crashed sogo with following backtrace:

(gdb) bt
#0 -[NGMimeRFC822DateHeaderFieldParser parseValue:ofHeaderField:] (self=0x88f076b8, _cmd=0x2e295b70, _data=0x8503cbe8, _field=0x0)
    at NGMimeRFC822DateHeaderFieldParser.m:130
0000001 0x0e2be8b8 in -[NGImap4ResponseParser _parseEnvelope] (self=0x7e96a5c8, _cmd=0x2e295bb0) at NGImap4ResponseParser.m:1544
0000002 0x0e2c81ff in -[NGImap4ResponseParser _parseNumberUntaggedResponse:] (self=0x7e96a5c8, _cmd=0x2e295a00, result_=0x7d0c7988)
    at NGImap4ResponseParser.m:1697
0000003 0x0e2c6d71 in -[NGImap4ResponseParser parseResponseForTagId:exception:] (self=0x7e96a5c8, _cmd=0x2e296c98, _tag=10, ex_=0xcfbdb084)
    at NGImap4ResponseParser.m:685
0000004 0x0e2d0837 in -[NGImap4Client processCommand:withTag:withNotification:logText:] (self=0x7f89fb88, _cmd=0x2e2970b0, _command=0x839a9008,
    _tag=Variable "_tag" is not available.
) at NGImap4Client.m:1508
0000005 0x0e2c9a26 in -[NGImap4Client processCommand:] (self=0x7f89fb88, _cmd=0x2e296cb8, _command=0x839a9008) at NGImap4Client.m:1579
0000006 0x0e2cbbce in -[NGImap4Client fetchUids:parts:] (self=0x7f89fb88, _cmd=0x2e2a08c8, _uids=0x87f803e8, _parts=0x7d281888)
    at NGImap4Client.m:865
0000007 0x0e2f878f in -[NGImap4Connection fetchUIDs:inURL:parts:] (self=0x8451ae48, _cmd=0x2fa8f9c0, _uids=0x87f803e8, _url=0x7e96a068,
    _parts=0x7d281888) at NGImap4Connection.m:541
0000008 0x0faa1da0 in -[SOGoMailFolder fetchUIDs:parts:] (self=0x7c19d488, _cmd=0x24b28038, _uids=0x87f803e8, _parts=0x7d281888)
    at SOGoMailFolder.m:555
0000009 0x04b316f5 in -[UIxMailListActions getHeadersForUIDs:inFolder:] (self=0x84518648, _cmd=0x24b27fe8, uids=0x87f803e8, mailFolder=0x7c19d488)
    at UIxMailListActions.m:597
0000010 0x04b314ea in -[UIxMailListActions getHeadersAction] (self=0x84518648, _cmd=0x7f29e758) at UIxMailListActions.m:722
0000011 0x0849b195 in -[NSObject performSelector:] (self=0x84518648, _cmd=0x2265e2f0, aSelector=0x7f29e758) at NSObject.m:1831
0000012 0x026c6020 in -[WODirectAction performActionNamed:] (self=0x84518648, _cmd=0x226b71a0, _actionName=0x84518d08) at WODirectAction.m:101
0000013 0x0275b9ab in -[SoActionInvocation callOnObject:withPositionalParametersWhenNotNil:inContext:] (self=0x87f80388, _cmd=0x226b71b8,
    _client=0x7c19d488, _positionalArgs=0x0, _ctx=0x81f67808) at SoActionInvocation.m:300
0000014 0x0275b7ce in -[SoActionInvocation callOnObject:inContext:] (self=0x87f80388, _cmd=0x226b7148, _client=0x7c19d488, _ctx=0x81f67808)
    at SoActionInvocation.m:316
0000015 0x0275b853 in -[SoActionInvocation callOnObject:withPositionalParametersWhenNotNil:inContext:] (self=0x8700c028, _cmd=0x226b71b8,
    _client=0x7c19d488, _positionalArgs=0x0, _ctx=0x81f67808) at SoActionInvocation.m:259
0000016 0x0275b7ce in -[SoActionInvocation callOnObject:inContext:] (self=0x8700c028, _cmd=0x226b51a8, _client=0x7c19d488, _ctx=0x81f67808)
    at SoActionInvocation.m:316
0000017 0x027553d9 in -[SoObjectMethodDispatcher dispatchInContext:] (self=0x7d0c7648, _cmd=0x226b59b8, _ctx=0x81f67808)
    at SoObjectMethodDispatcher.m:191
0000018 0x0275765a in -[SoObjectRequestHandler handleRequest:inContext:session:application:] (self=0x8ad3dc88, _cmd=0x22667f38, _rq=0x87006a08,
    _ctx=0x81f67808, _sn=0x0, app=0x7fff0208) at SoObjectRequestHandler.m:591
0000019 0x026d8697 in -[WORequestHandler handleRequest:] (self=0x8ad3dc88, _cmd=0x22645948, _request=0x87006a08) at WORequestHandler.m:241
0000020 0x0269537d in -[WOCoreApplication dispatchRequest:usingHandler:] (self=0x7fff0208, _cmd=0x22645978, _request=0x87006a08, handler=0x8ad3dc88)
    at WOCoreApplication.m:704
0000021 0x0269525e in -[WOCoreApplication dispatchRequest:] (self=0x7fff0208, _cmd=0x3c0029b8, _request=0x87006a08) at WOCoreApplication.m:744
0000022 0x1c0036a3 in -[SOGo dispatchRequest:] (self=0x7fff0208, _cmd=0x226a53b0, _request=0x87006a08) at SOGo.m:436
0000023 0x027445bb in -[WOHttpTransaction _run] (self=0x87006888, _cmd=0x226a53c8) at WOHttpTransaction.m:546
0000024 0x0274766a in -[WOHttpTransaction run] (self=0x87006888, _cmd=0x226a46a8) at WOHttpTransaction.m:599
0000025 0x02740fe5 in -[WOHttpAdaptor runConnection:] (self=0x7d2818c8, _cmd=0x226a46f8, _socket=0x7d0d60c8) at WOHttpAdaptor.m:398
0000026 0x02742ce6 in -[WOHttpAdaptor _handleAcceptedConnection:] (self=0x7d2818c8, _cmd=0x226a4700, _connection=0x7d0d60c8) at WOHttpAdaptor.m:432
0000027 0x027429f2 in -[WOHttpAdaptor _handleConnection:] (self=0x7d2818c8, _cmd=0x226a4780, connection=0x7d0d60c8) at WOHttpAdaptor.m:543
0000028 0x02742eaf in -[WOHttpAdaptor acceptConnection:] (self=0x7d2818c8, _cmd=0x226a4688, _notification=0x852b8168) at WOHttpAdaptor.m:607
0000029 0x0848b71e in -[NSNotificationCenter _postAndRelease:] (self=0x8024e5d8, _cmd=0x2837c1d0, notification=0x852b8168)
    at NSNotificationCenter.m:1161
0000030 0x0848a948 in -[NSNotificationCenter postNotificationName:object:userInfo:] (self=0x8024e5d8, _cmd=0x2837c1d8, name=0x28ec809c,
    object=0x7d2810c8, info=0x0) at NSNotificationCenter.m:1220
0000031 0x0848a7be in -[NSNotificationCenter postNotificationName:object:] (self=0x8024e5d8, _cmd=0x28ec8028, name=0x28ec809c, object=0x7d2810c8)
    at NSNotificationCenter.m:1200
0000032 0x08eef8f2 in -[NSObject(FileObjectWatcher) receivedEvent:type:extra:forMode:] (self=0x7d2810c8, _cmd=0x283d0b40, _fdData=0xb,
    _type=ET_RDESC, _extra=0xb, _mode=0x283900c0) at NSRunLoop+FileObjects.m:57
0000033 0x0859f3de in -[GSRunLoopCtxt pollUntil:within:] (self=0x7fff0e88, _cmd=0x28390050, milliseconds=26395, contexts=0x86f1ab88)
    at GSRunLoopCtxt.m:636
0000034 0x084dab62 in -[NSRunLoop acceptInputForMode:beforeDate:] (self=0x86f1a928, _cmd=0x28390078, mode=0x283900c0, limit_date=0x7d27ec28)
    at NSRunLoop.m:1197
0000035 0x084d8c83 in -[NSRunLoop runMode:beforeDate:] (self=0x86f1a928, _cmd=0x226458b8, mode=0x283900c0, date=0x86f1a3e8) at NSRunLoop.m:1265
0000036 0x02695d31 in -[WOCoreApplication run] (self=0x7fff0208, _cmd=0x3c0028c8) at WOCoreApplication.m:576
0000037 0x1c001b22 in -[SOGo run] () at SOGo.m:260
0000038 0x026c197e in WOApplicationMain (_appClassName=0x3c00196c, argc=5, argv=0xcfbdc0b8) at WOApplicationMain.m:42
0000039 0x026e36bd in WOWatchDogApplicationMain (appName=0x3c00196c, argc=5, argv=0xcfbdc0b8) at WOWatchDogApplicationMain.m:969
0000040 0x1c001697 in gnustep_base_user_main (argc=5, argv=0xcfbdc0b8, env=0xcfbdc0d0) at sogod.m:53
0000041 0x084c9c9e in main (argc=5, argv=Cannot access memory at address 0x4
) at NSProcessInfo.m:933
0000042 0x1c001397 in ___start ()
0000043 0x1c001317 in _start ()
0000044 0x00000000 in ?? ()
(gdb) frame 0
#0 -[NGMimeRFC822DateHeaderFieldParser parseValue:ofHeaderField:] (self=0x88f076b8, _cmd=0x2e295b70, _data=0x8503cbe8, _field=0x0)
    at NGMimeRFC822DateHeaderFieldParser.m:130
130 while (!isdigit(*p))
(gdb) list
125 static inline char *digitsString(const char *string) {
126 const char *p;
127 unsigned int len;
129 p = string;
130 while (!isdigit(*p))
131 p++;
132 len = 0;
133 while (isdigit(*(p + len)))
134 len++;
#0 -[NGMimeRFC822DateHeaderFieldParser parseValue:ofHeaderField:] (self=0x88f076b8, _cmd=0x2e295b70, _data=0x8503cbe8, _field=0x0)
    at NGMimeRFC822DateHeaderFieldParser.m:130
130 while (!isdigit(*p))
(gdb) list
125 static inline char *digitsString(const char *string) {
126 const char *p;
127 unsigned int len;
129 p = string;
130 while (!isdigit(*p))
131 p++;
132 len = 0;
133 while (isdigit(*(p + len)))
134 len++;
(gdb) print string
No symbol "string" in current context.
(gdb) po string
No symbol "string" in current context.
(gdb) print *string
No symbol "string" in current context.
(gdb) frame 1
0000001 0x0e2be8b8 in -[NGImap4ResponseParser _parseEnvelope] (self=0x7e96a5c8, _cmd=0x2e295bb0) at NGImap4ResponseParser.m:1544
1544 env->date = [[dateParser parseValue:dateStr ofHeaderField:nil] retain];
(gdb) list
1539 /* parse date */
1541 dateStr = [self _parseQuotedStringOrNIL];
1542 [self _consumeOptionalSpace];
1543 if ([dateStr isNotNull])
1544 env->date = [[dateParser parseValue:dateStr ofHeaderField:nil] retain];
1546 /* parse subject */
1548 if ((tmp = [self _parseQuotedStringOrDataOrNIL]) != nil) {
(gdb) print dateStr
$2 = (class NSString *) 0x8503cbe8
(gdb) po dateStr
Tue, 28 Sep 2010 08:51:20 GMT
Additional InformationThis happened when scrolling through my trash folder, I only found one mail with the date from the backtrace in the Trash folder. I copied it into a test folder with thunderbird. Afterwards I was suddenly able to enter the test folder without the crasher. diff -u of both mail files on the imap server showed no difference.

I'm on OpenBSD i386, using sope and sogo 1.3.4, and gnustep-base-1.18.0p2

IMAP Server is cyrus imapd.
TagsNo tags attached.
Attached Filestxt file icon mail.txt [^] (2,767 bytes) 2010-12-01 13:58 [Show Content]
? file icon patch-sope-mime_NGMime_NGMimeRFC822DateHeaderFieldParser_m.orig [^] (911 bytes) 2011-05-09 11:57

- Relationships Relation Graph ] Dependency Graph ]
has duplicate 0001021resolvedludovic specific mail crashes sogo in SOPE NGMimeRFC822DateHeaderFieldParser 

-  Notes
User avatar (0001906)
ludovic (administrator)
2010-12-01 17:09

Works for me too.

Are you sure you're using the "Inverse" version of SOPE?
buzzdee (reporter)
2010-12-02 02:26

Why do you think I don't use it? Do you have seen sth. unusual in the backtrace?
Its maybe due to OpenBSD's "randomness" all over the place, that bugs that stay hidden on other OS/Platforms kick in here.

Yes, I use the Inverse version of SOPE. I use the port I created for OpenBSD: [^]
In the Makefile there you find the URL I used to download the sources.
In the patches directory you find some patches I used to get it to work, and to get rid of some compilation warnings.

As promised in the e-mail I sent, meanwhile some time ago, I'll probably start on the weekend to open some bug reports, and attaching the patches I have, and explain in detail, what they are good for.

sogod SOGoDraftsFolderName INBOX.Drafts
sogod SOGoUserSources '(
        CNFieldName = cn;
        IDFieldName = uid;
        IMAPHostFieldName = mailHost;
        UIDFieldName = uid;
        baseDN = "ou=people,dc=intern";
        bindDN = "cn=Manager,dc=intern";
        bindPassword = MyPassword;
        canAuthenticate = YES;
        displayName = "SOGo Accounts";
        hostname = ldapHost;
        id = public;
        isAddressBook = YES;
        port = 389;
sogod SOGoSMTPServer SMTPServer
sogod SOGoIMAPServer IMAPServer
sogod SOGoLanguage English
sogod NGImap4ConnectionStringSeparator .
sogod SOGoProfileURL postgresql://_sogo:PASSWORD@DBSERVER:5432/sogo/sogo_user_profile
sogod SOGoTimeZone Europe/Berlin
sogod SOGoFoldersSendEMailNotifications YES
sogod SOGoMemcachedHost localhost
sogod SOGoMailingMechanism smtp
sogod SOGoTrashFolderName INBOX.Trash
sogod WOLogFile /var/log/sogo/sogod.log
sogod WOPidFile /var/sogo/
sogod SOGoMailDomain
sogod OCSFolderInfoURL postgresql://_sogo:PASSWORD@DBSERVER:5432/sogo/sogo_folder_info
sogod SOGoSentFolderName INBOX.Sent
sogod SOGoACLsSendEMailNotifications YES
sogod SOGoAppointmentSendEMailNotifications YES
sogod WOWorkersCount 1
User avatar (0001917)
ludovic (administrator)
2010-12-02 10:45

Try to add WOMessageUseUTF8 = YES to your configuration and see if the crashers are still there.
User avatar (0001918)
ludovic (administrator)
2010-12-02 10:47

Also set WOParsersUseUTF8 = YES.
User avatar (0001919)
ludovic (administrator)
2010-12-02 10:47

If you're still getting errors, you might want to give us SSH access, a test account and sudo access for gdb to test this on OpenBSD.
buzzdee (reporter)
2010-12-02 13:16

Hi Ludovic,
With those two defaults set, I don't get the crasher anymore.
Now I see messages like the following in the sogod.log:
Dec 02 18:01:23 sogod [16467]: <0x0x2d35b3a0[NSString]> Got incomplete multibyte sequence. ToEncode: UCS-2-INTERNAL FromEncode: UTF-8
Dec 02 18:01:23 sogod [16467]: <0x0x2d35b3a0[NSString]> Got invalid multibyte sequence. ToEncode: UCS-2-INTERNAL FromEncode: UTF-8.

Dec 02 18:07:01 sogod [19776]: <0x0x276d63a0[NSString]> Got invalid multibyte sequence. ToEncode: UCS-2-INTERNAL FromEncode: US-ASCII. - - [02/Dec/2010:18:07:03 GMT] "POST /SOGo/so/sebastia/Mail//0/folderINBOX/folderTrash/headers HTTP/1.1" 200 5264/537 1.918 34814 84% -
Dec 02 18:07:03 sogod [19776]: <0x0x276d63a0[NSString]> Got invalid multibyte sequence. ToEncode: UCS-2-INTERNAL FromEncode: US-ASCII. - - [02/Dec/2010:18:07:04 GMT] "POST /SOGo/so/sebastia/Mail//0/folderINBOX/folderTrash/headers HTTP/1.1" 200 5096/509 1.038 32932 84% -
Those seem to be new to me, I cannot remember having seen them before.

Only the abort in libiconv_close still seems to be there.
buzzdee (reporter)
2011-05-09 03:38


I still get this error with 1.3.7, and had some time on the weekend to spend a couple of hours to further debug the problem. I came up with attached patch, fixing the problem for me. I found that the problem only happens on timezones that are just only i.e. GMT instead "GMT +100" or the like.

I now only call digitsString(p) in case the strlen of p is > 0.

please review this patch, and consider for inclusion to sope.
User avatar (0002448)
ludovic (administrator)
2011-05-09 11:52

You forgot to attach the patch!
buzzdee (reporter)
2011-05-09 11:57

sorry, now the patch is attached (:
User avatar (0002451)
ludovic (administrator)
2011-05-09 16:43 [^]
buzzdee (reporter)
2011-05-10 08:59

Thanks Ludovic for taking the patch. But as I was told by a fellow OpenBSD porter, the second part of the patch is superfluous:

@@ -186,7 +189,9 @@ static NSTimeZone *parseTimeZone(const c
     NSLog (@"parseTimeZone: cannot parse time notation '%s'", newString);
- free(digits);
+ if (digits != NULL) {
+ free(digits);
+ }

so free(digits), even if it is NULL, is valid C (I verified by reading up on that, and recompiled without that part of the patch, and it doesn't crash)
So it should be save to remove this unnecessary if statement.
User avatar (0002456)
ludovic (administrator)
2011-05-10 15:58

Fix updated and pushed.

- Issue History
Date Modified Username Field Change
2010-12-01 13:58 buzzdee New Issue
2010-12-01 13:58 buzzdee File Added: mail.txt
2010-12-01 17:09 ludovic Note Added: 0001906
2010-12-02 02:26 buzzdee Note Added: 0001907
2010-12-02 10:45 ludovic Note Added: 0001917
2010-12-02 10:47 ludovic Note Added: 0001918
2010-12-02 10:47 ludovic Note Added: 0001919
2010-12-02 13:16 buzzdee Note Added: 0001922
2011-02-15 17:02 ludovic Status new => assigned
2011-02-15 17:02 ludovic Assigned To => ludovic
2011-05-09 03:38 buzzdee Note Added: 0002446
2011-05-09 11:52 ludovic Note Added: 0002448
2011-05-09 11:57 buzzdee File Added: patch-sope-mime_NGMime_NGMimeRFC822DateHeaderFieldParser_m.orig
2011-05-09 11:57 buzzdee Note Added: 0002449
2011-05-09 16:43 ludovic Note Added: 0002451
2011-05-09 16:43 ludovic Status assigned => resolved
2011-05-09 16:43 ludovic Fixed in Version => 1.3.8
2011-05-09 16:43 ludovic Resolution open => fixed
2011-05-10 08:59 buzzdee Note Added: 0002454
2011-05-10 08:59 buzzdee Status resolved => feedback
2011-05-10 08:59 buzzdee Resolution fixed => reopened
2011-05-10 15:58 ludovic Note Added: 0002456
2011-05-10 15:58 ludovic Status feedback => resolved
2011-05-10 15:58 ludovic Resolution reopened => fixed
2011-05-13 07:03 ludovic Relationship added has duplicate 0001021

Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker