Skip to content

Commit

Permalink
Merge pull request #36467 from Qrox/fix-use-after-free
Browse files Browse the repository at this point in the history
Fix use-after-free in translations.cpp
  • Loading branch information
ZhilkinSerg authored Dec 26, 2019
2 parents 9e77218 + f1efb1a commit 9a9104f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ void translation::deserialize( JsonIn &jsin )
#ifndef CATA_IN_TOOL
if( test_mode ) {
check_style = !jsobj.has_member( "//NOLINT(cata-text-style)" );
throw_error = [&jsobj]( const std::string & msg, const int offset ) {
// Copying jsobj to avoid use-after-free
throw_error = [jsobj]( const std::string & msg, const int offset ) {
jsobj.get_raw( "str" )->error( msg, offset );
};
}
Expand Down

0 comments on commit 9a9104f

Please sign in to comment.