Skip to content
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
13 changes: 0 additions & 13 deletions io/fields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ class VisitorBase : public IFieldsVisitor {
}
return true;
}

bool CheckStringU32(uint32_t u32, uint32_t i, uint32_t num_u32) {
// Although strings are zero-padded to u32, an entire u32 should not be
// zero.
if (HWY_UNLIKELY(u32 == 0)) {
NotifyInvalid("Invalid characters %x at %u of %u\n", u32, i, num_u32);
return false;
}
return true;
}
};

class PrintVisitor : public VisitorBase {
Expand Down Expand Up @@ -170,7 +160,6 @@ class ReadVisitor : public VisitorBase {
for (uint32_t i = 0; i < num_u32; ++i) {
uint32_t u32;
operator()(u32);
(void)CheckStringU32(u32, i, num_u32);
hwy::CopyBytes(&u32, value.data() + i * k4, k4);
}

Expand Down Expand Up @@ -278,7 +267,6 @@ class WriteVisitor : public VisitorBase {
for (uint32_t i = 0; i < num_whole_u32; ++i) {
uint32_t u32 = 0;
hwy::CopyBytes(value.data() + i * k4, &u32, k4);
if (HWY_UNLIKELY(!CheckStringU32(u32, i, num_u32))) return;
storage_.push_back(u32);
}

Expand All @@ -292,7 +280,6 @@ class WriteVisitor : public VisitorBase {
const uint32_t next = static_cast<uint32_t>(static_cast<uint8_t>(c));
u32 += next << (i * 8);
}
if (HWY_UNLIKELY(!CheckStringU32(u32, num_whole_u32, num_u32))) return;
storage_.push_back(u32);
}
}
Expand Down
3 changes: 0 additions & 3 deletions io/fields_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ TEST(FieldsTest, TestInvalidFloat) {
// Refuse to write invalid strings.
TEST(FieldsTest, TestInvalidString) {
NewFields new_fields;
// Four zero bytes
new_fields.new_str.assign(4, '\0');
EXPECT_TRUE(new_fields.Write().empty());

// Too long
new_fields.new_str.assign(257, 'a');
Expand Down
Loading