summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tag_array.cpp8
-rw-r--r--src/tag_list.cpp4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/tag_array.cpp b/src/tag_array.cpp
index 94b8ffe7ac..f83bce11f7 100644
--- a/src/tag_array.cpp
+++ b/src/tag_array.cpp
@@ -107,7 +107,9 @@ void tag_array<int8_t>::read_payload(io::stream_reader& reader)
{
int32_t length;
reader.read_num(length);
- if(length < 0 || !reader.get_istr())
+ if(length < 0)
+ reader.get_istr().setstate(std::ios::failbit);
+ if(!reader.get_istr())
throw io::input_error("Error reading length of tag_byte_array");
data.resize(length);
@@ -121,7 +123,9 @@ void tag_array<int32_t>::read_payload(io::stream_reader& reader)
{
int32_t length;
reader.read_num(length);
- if(length < 0 || !reader.get_istr())
+ if(length < 0)
+ reader.get_istr().setstate(std::ios::failbit);
+ if(!reader.get_istr())
throw io::input_error("Error reading length of tag_int_array");
data.clear();
diff --git a/src/tag_list.cpp b/src/tag_list.cpp
index 53c1a8e392..f5a5b91758 100644
--- a/src/tag_list.cpp
+++ b/src/tag_list.cpp
@@ -138,7 +138,9 @@ void tag_list::read_payload(io::stream_reader& reader)
int32_t length;
reader.read_num(length);
- if(length < 0 || !reader.get_istr())
+ if(length < 0)
+ reader.get_istr().setstate(std::ios::failbit);
+ if(!reader.get_istr())
throw io::input_error("Error reading length of tag_list");
if(lt != tag_type::End)