LibPDF: Fix two use-after-frees
Two lambdas were capturing locals that were out of scope by the time the lambdas ran. With this, `pdf` can successfully load and print the page count of pdf_reference_1.7.pdf.
This commit is contained in:
parent
6111a9f9d0
commit
826c0426f3
Notes:
sideshowbarker
2024-07-17 01:10:58 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/826c0426f3 Pull-request: https://github.com/SerenityOS/serenity/pull/19925 Reviewed-by: https://github.com/mattco98 ✅
1 changed files with 4 additions and 4 deletions
|
@ -323,8 +323,8 @@ void StandardSecurityHandler::encrypt(NonnullRefPtr<Object> object, Reference re
|
|||
auto stream = object->cast<StreamObject>();
|
||||
bytes = stream->bytes();
|
||||
|
||||
assign = [&stream](ByteBuffer const& buffer) {
|
||||
stream->buffer() = buffer;
|
||||
assign = [&object](ByteBuffer const& buffer) {
|
||||
object->cast<StreamObject>()->buffer() = buffer;
|
||||
};
|
||||
|
||||
if (stream->dict()->contains(CommonNames::Filter)) {
|
||||
|
@ -335,8 +335,8 @@ void StandardSecurityHandler::encrypt(NonnullRefPtr<Object> object, Reference re
|
|||
} else if (object->is<StringObject>()) {
|
||||
auto string = object->cast<StringObject>();
|
||||
bytes = string->string().bytes();
|
||||
assign = [&string](ByteBuffer const& buffer) {
|
||||
string->set_string(DeprecatedString(buffer.bytes()));
|
||||
assign = [&object](ByteBuffer const& buffer) {
|
||||
object->cast<StringObject>()->set_string(DeprecatedString(buffer.bytes()));
|
||||
};
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Reference in a new issue