-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4579 from cyrusimap/issue_4574
jmap_mail: do not dereference NULL pointer in Email/parse
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_email_parse_inmemory_blob | ||
:min_version_3_9 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
my $jmap = $self->{jmap}; | ||
|
||
# XXX: replace with the upstream one once RFC 9404 is finished | ||
$jmap->AddUsing('https://cyrusimap.org/ns/jmap/blob'); | ||
|
||
my $mimeMsg = <<'EOF'; | ||
From: <from@local> | ||
To: to@local | ||
Bcc: bcc@local | ||
Subject: test | ||
Date: Mon, 13 Apr 2020 15:34:03 +0200 | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain | ||
hello | ||
EOF | ||
$mimeMsg =~ s/\r?\n/\r\n/gs; | ||
|
||
# XXX: can't use a result reference in array | ||
my $blobId = 'G67501cd2e1eaaf65d25e6f3b49554d2193f06ee8'; | ||
|
||
$res = $jmap->CallMethods([ | ||
['Blob/upload', { | ||
create => { | ||
b1 => { | ||
data => [{'data:asText' => $mimeMsg}] | ||
}, | ||
}, | ||
}, 'R1'], | ||
['Email/parse', { | ||
blobIds => [$blobId], | ||
properties => ['subject', 'bodyStructure'], | ||
}, 'R2'], | ||
]); | ||
$self->assert_str_equals('Blob/upload', $res->[0][0]); | ||
$self->assert_not_null($res->[0][1]{created}{b1}{id}); | ||
$self->assert_str_equals('test', $res->[1][1]{parsed}{$blobId}{subject}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters