Closed Bug 1889159 Opened 1 year ago Closed 1 year ago

ASAN Build of C-C TB complains that SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimebuf.cpp:132:10

Categories

(MailNews Core :: MIME, enhancement)

x86_64
Linux
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1852662

People

(Reporter: ishikawa, Unassigned)

Details

I think this is picked up by very strict ASAN undefined behavior checker.
The leading part of error messages that leads the stopping of ASAN build of C-C TB is as follows.
I think there are mixed messages that confuse the readers.
I ran ASAN build of C-C TB twice to get a clean message dumpl

/NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimebuf.cpp:132:10: runtime error: call to function MimeMessage_parse_line(char const*, int, MimeObject*) through pointer to incorrect function type 'int (*)(char *, unsigned int, void *)'
/NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimemsg.cpp:99: note: MimeMessage_parse_line(char const*, int, MimeObject*) defined here
    #0 0x7f5af86c68bc in convert_and_send_buffer(char*, int, bool, int (*)(char*, unsigned int, void*), void*) /NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimebuf.cpp:132:10
    #1 0x7f5af86c6437 in mime_LineBuffer /NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimebuf.cpp:205:14
    #2 0x7f5af872b56b in MimeObject_parse_buffer(char const*, int, MimeObject*) /NEW-SSD/NREF-COMM-CENTRAL/mozilla/comm/mailnews/mime/src/mimeobj.cpp:223:10

The message was dumped when I tried to select the messages in Inbox folder.

ASAN complains that convert_and_send_buffer(char*, int, bool, int ()(char, unsigned int, void*), void*)
is called
with the arguments like this.
https://searchfox.org/comm-central/source/mailnews/mime/src/mimebuf.cpp#205

    status = convert_and_send_buffer(*bufferP, *buffer_fpP, convert_newlines_p,
                                     per_line_fn, closure);

per_line_fn is declared on https://searchfox.org/comm-central/source/mailnews/mime/src/mimebuf.cpp#138

    int32_t (*per_line_fn)(char* line, uint32_t line_length, void* closure),

MimeMessage_parse_line()
is defined in a different file,
https://searchfox.org/comm-central/source/mailnews/mime/src/mimemsg.cpp#98
as follows.

static int MimeMessage_parse_line(const char* aLine, int32_t aLength,
                                  MimeObject* obj) {

I think maybe the delcaration of |MimeObject) is not visible in mimebuf.cpp and thus the use of (void*) pointer instead of |MimeObject*| pointer.

Something needs to be done to test ASAN build of C-C TB to proceed from this point.
I will see what patch I can create.

Status: NEW → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1852662
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.