Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a5e0a9

Browse files
committed
Fix the new ARMv8 CRC code for short and unaligned input.
The code before the main loop, to handle the possible 1-7 unaligned bytesat the beginning of the input, was broken, and read past the input, if thethe input was very short.
1 parentee9e145 commit3a5e0a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/port/pg_crc32c_armv8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len)
2929
* significantly faster. Process leading bytes so that the loop below
3030
* starts with a pointer aligned to eight bytes.
3131
*/
32-
if (!PointerIsAligned(p,uint16)&&p<pend)
32+
if (!PointerIsAligned(p,uint16)&&p+1 <=pend)
3333
{
3434
crc=__crc32cb(crc,*p);
3535
p+=1;
3636
}
37-
if (!PointerIsAligned(p,uint32)&&p<pend)
37+
if (!PointerIsAligned(p,uint32)&&p+2 <=pend)
3838
{
3939
crc=__crc32ch(crc,*(uint16*)p);
4040
p+=2;
4141
}
42-
if (!PointerIsAligned(p,uint64)&&p<pend)
42+
if (!PointerIsAligned(p,uint64)&&p+4 <=pend)
4343
{
4444
crc=__crc32cw(crc,*(uint32*)p);
4545
p+=4;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp