Skip to content

Commit f44d2f0

Browse files
committed
Core (LV::Video): Fix PNG loader not resetting stream position on error right after reading signature.
1 parent a8c959a commit f44d2f0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libvisual/libvisual/private/lv_video_png.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ namespace LV {
6262

6363
png_byte signature[8];
6464
input.read (reinterpret_cast<char*> (signature), sizeof (signature));
65+
input.seekg (saved_stream_pos);
66+
67+
if (!input) {
68+
return nullptr;
69+
}
6570

6671
bool is_png = !png_sig_cmp (signature, 0, sizeof (signature));
6772

@@ -100,6 +105,8 @@ namespace LV {
100105
return nullptr;
101106
}
102107

108+
input.seekg (sizeof (signature), std::ios::cur);
109+
103110
png_set_read_fn (png_ptr, &input, handle_png_read);
104111

105112
png_set_sig_bytes (png_ptr, sizeof (signature));

0 commit comments

Comments
 (0)