Skip to content

Commit 5ae19c3

Browse files
committed
Bug#34538071 NDBXFRM1 reader wrongly trimmed trailing non-zeros for header and trailer
Fixup 8.0.22: WL#13499 ndb_az31, ndb_ndbxfrm1: File format classes The intention has always been that NDBXFRM1 reader will trim the trailing zeros from header and trailer, but the bug caused the opposite trimming non zeros. This has not been a problem in 8.0.30 or earlier since the last field in header was a zero word padding, and for trailer the last field was for data checksum that was never checked and the next last field was file checksum that was never written and always zero. Change-Id: If6bdea3fab6d070aeb563697891dd902b38bdd03
1 parent 7884d09 commit 5ae19c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

storage/ndb/src/common/util/ndb_ndbxfrm1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ int ndb_ndbxfrm1::header::read_header(ndbxfrm_input_iterator* in)
143143
if (fixed_header_size > header_size)
144144
RETURN(-1);
145145
Uint32 copy_size = fixed_header_size;
146-
while (copy_size > 0 && p[copy_size - 1] != 0)
146+
while (copy_size > 0 && p[copy_size - 1] == 0)
147147
{
148148
copy_size--;
149149
}
@@ -1088,7 +1088,7 @@ int ndb_ndbxfrm1::trailer::read_trailer(ndbxfrm_input_reverse_iterator* in)
10881088

10891089
Uint32 copy_size = fixed_trailer_size - sizeof(fixed_trailer::magic);
10901090
const byte* pt = reinterpret_cast<const byte*>(trailerp);
1091-
while (copy_size > 0 && pt[copy_size - 1] != 0)
1091+
while (copy_size > 0 && pt[copy_size - 1] == 0)
10921092
{
10931093
copy_size--;
10941094
}

0 commit comments

Comments
 (0)