Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
6222ae88
Verified
Commit
6222ae88
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Fix crash on invalid utf8 in decrypted events
parent
e8e48305
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1483
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Olm.cpp
+12
-12
12 additions, 12 deletions
src/Olm.cpp
with
12 additions
and
12 deletions
src/Olm.cpp
+
12
−
12
View file @
6222ae88
...
...
@@ -1048,24 +1048,24 @@ decryptEvent(const MegolmSessionIndex &index,
return
{
DecryptionErrorCode
::
DecryptionFailed
,
e
.
what
(),
std
::
nullopt
};
}
// Add missing fields for the event.
json
body
=
json
::
parse
(
msg_str
);
body
[
"event_id"
]
=
event
.
event_id
;
body
[
"sender"
]
=
event
.
sender
;
body
[
"origin_server_ts"
]
=
event
.
origin_server_ts
;
body
[
"unsigned"
]
=
event
.
unsigned_data
;
try
{
// Add missing fields for the event.
json
body
=
json
::
parse
(
msg_str
);
body
[
"event_id"
]
=
event
.
event_id
;
body
[
"sender"
]
=
event
.
sender
;
body
[
"origin_server_ts"
]
=
event
.
origin_server_ts
;
body
[
"unsigned"
]
=
event
.
unsigned_data
;
// relations are unencrypted in content...
mtx
::
common
::
add_relations
(
body
[
"content"
],
event
.
content
.
relations
);
// relations are unencrypted in content...
mtx
::
common
::
add_relations
(
body
[
"content"
],
event
.
content
.
relations
);
mtx
::
events
::
collections
::
TimelineEvent
te
;
try
{
mtx
::
events
::
collections
::
TimelineEvent
te
;
mtx
::
events
::
collections
::
from_json
(
body
,
te
);
return
{
std
::
nullopt
,
std
::
nullopt
,
std
::
move
(
te
.
data
)};
}
catch
(
std
::
exception
&
e
)
{
return
{
DecryptionErrorCode
::
ParsingFailed
,
e
.
what
(),
std
::
nullopt
};
}
return
{
std
::
nullopt
,
std
::
nullopt
,
std
::
move
(
te
.
data
)};
}
crypto
::
Trust
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment