1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Fixes: individual static analysers reset tapes, for potential successors. The ZX81 file analyser no longer overruns its buffer upon receiving a file that is shorter than 11 bytes.

This commit is contained in:
Thomas Harte 2017-07-12 21:34:08 -04:00
parent f09fe30af5
commit 33d16ae0cd
5 changed files with 6 additions and 2 deletions

View File

@ -75,6 +75,7 @@ void StaticAnalyser::Acorn::AddTargets(
if(tapes.size() > 0) {
std::shared_ptr<Storage::Tape::Tape> tape = tapes.front();
std::list<File> files = GetFiles(tape);
tape->reset();
// continue if there are any files
if(files.size()) {

View File

@ -68,6 +68,7 @@ void StaticAnalyser::Commodore::AddTargets(
// check tapes
for(auto &tape : tapes) {
std::list<File> tape_files = GetFiles(tape);
tape->reset();
if(tape_files.size()) {
files.splice(files.end(), tape_files);
target.tapes = tapes;

View File

@ -84,8 +84,9 @@ void StaticAnalyser::Oric::AddTargets(
int basic10_votes = 0;
int basic11_votes = 0;
for(auto tape : tapes) {
for(auto &tape : tapes) {
std::list<File> tape_files = GetFiles(tape);
tape->reset();
if(tape_files.size()) {
for(auto file : tape_files) {
if(file.data_type == File::MachineCode) {

View File

@ -35,6 +35,7 @@ void StaticAnalyser::ZX8081::AddTargets(
if(!tapes.empty()) {
std::vector<Storage::Data::ZX8081::File> files = GetFiles(tapes.front());
tapes.front()->reset();
if(!files.empty()) {
StaticAnalyser::Target target;
target.machine = Target::ZX8081;

View File

@ -51,7 +51,7 @@ static std::shared_ptr<File> ZX81FileFromData(const std::vector<uint8_t> &data)
// Look for a file name.
size_t data_pointer = 0;
int c = 11;
while(c--) {
while(c < data.size() && c--) {
if(data[data_pointer] & 0x80) break;
data_pointer++;
}