Skip to content

Bugfix: Use correct length of LZSS compressed file for decompression #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/SNU/extras/NiNaBoot/NiNaBoot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ int main() {
/* Initialize the lzss module with the data which
* it requires.
*/
lzss_init(&update_file, (uint32_t)SKETCH_START);
uint32_t const LZSS_FILE_SIZE = update_file.size() - sizeof(ota_header.buf);
lzss_init(&update_file, (uint32_t)SKETCH_START, LZSS_FILE_SIZE);
/* During the process of decoding UPDATE.BIN.LZSS
* is decompressed and stored as UPDATE.BIN.
*/
Expand Down
4 changes: 2 additions & 2 deletions libraries/SNU/extras/NiNaBoot/lzss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ static uint32_t flash_addr = 0;
PUBLIC FUNCTIONS
**************************************************************************************/

void lzss_init(WiFiStorageFile * update_file_ptr, uint32_t const sketch_start)
void lzss_init(WiFiStorageFile * update_file_ptr, uint32_t const sketch_start, uint32_t const lzss_file_size)
{
SKETCH_START = sketch_start;
flash_addr = sketch_start;
update_file = update_file_ptr;
LZSS_FILE_SIZE = update_file->size();
LZSS_FILE_SIZE = lzss_file_size;
}

void lzss_flush()
Expand Down
2 changes: 1 addition & 1 deletion libraries/SNU/extras/NiNaBoot/lzss.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
FUNCTION DEFINITION
**************************************************************************************/

void lzss_init(WiFiStorageFile * update_file_ptr, uint32_t const sketch_start);
void lzss_init(WiFiStorageFile * update_file_ptr, uint32_t const sketch_start, uint32_t const lzss_file_size);
void lzss_decode();
void lzss_flush();

Expand Down
Loading