Skip to content

Commit

Permalink
quic: do not dereference shared_ptr after move
Browse files Browse the repository at this point in the history
The stored pointer is assumed to be nullptr after std::move.

PR-URL: #47294
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
tniessen authored and jasnell committed Mar 29, 2023
1 parent c81e114 commit 9b104be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/quic/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ Store::Store(std::shared_ptr<v8::BackingStore> store,
size_t length,
size_t offset)
: store_(std::move(store)), length_(length), offset_(offset) {
CHECK_LE(offset_, store->ByteLength());
CHECK_LE(length_, store->ByteLength() - offset_);
CHECK_LE(offset_, store_->ByteLength());
CHECK_LE(length_, store_->ByteLength() - offset_);
}

Store::Store(std::unique_ptr<v8::BackingStore> store,
size_t length,
size_t offset)
: store_(std::move(store)), length_(length), offset_(offset) {
CHECK_LE(offset_, store->ByteLength());
CHECK_LE(length_, store->ByteLength() - offset_);
CHECK_LE(offset_, store_->ByteLength());
CHECK_LE(length_, store_->ByteLength() - offset_);
}

Store::Store(v8::Local<v8::ArrayBuffer> buffer, Option option)
Expand Down

0 comments on commit 9b104be

Please sign in to comment.