mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
Level: make buffer a member to prevent use-after-free
This commit is contained in:
parent
1d3db43d29
commit
b3c1a9be2f
2 changed files with 4 additions and 3 deletions
|
@ -29,14 +29,12 @@
|
|||
#include "../Util.hpp"
|
||||
#include "../NBT/IntTag.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace MinedMap {
|
||||
namespace World {
|
||||
|
||||
Level::Level(const char *filename) {
|
||||
std::vector<uint8_t> buffer = readGZip(filename);
|
||||
buffer = readGZip(filename);
|
||||
|
||||
Buffer nbt(buffer.data(), buffer.size());
|
||||
std::pair<std::string, std::shared_ptr<const NBT::Tag>> tag = NBT::Tag::readNamedTag(&nbt);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "../NBT/CompoundTag.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace MinedMap {
|
||||
|
@ -36,6 +37,8 @@ namespace World {
|
|||
|
||||
class Level {
|
||||
private:
|
||||
std::vector<uint8_t> buffer;
|
||||
|
||||
std::shared_ptr<const NBT::CompoundTag> root;
|
||||
std::shared_ptr<const NBT::CompoundTag> data;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue