Skip to content

Commit

Permalink
fix: offset
Browse files Browse the repository at this point in the history
  • Loading branch information
ging-dev committed Jun 22, 2023
1 parent 543de82 commit d3e032a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ function ($data) {

// work with .spr case
if ("\x50\x4c\x54\x45" === $four_bytes && '' === $beforeIDAT) {
fseek($data, $offset - 4);
$offset -= 4;
fseek($data, $offset);
$skip_bytes = 0;
do {
[$type, $chunk, $length] = $png_chunk($data);
Expand All @@ -53,7 +54,8 @@ function ($data) {
}

if ("\x49\x48\x44\x52" === $four_bytes) {
fseek($data, $offset - 4);
$offset -= 4;
fseek($data, $offset);
$png_data = "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a";
$i = $skip_bytes = 0;
do {
Expand Down

0 comments on commit d3e032a

Please sign in to comment.