GCC Compiler Warnings in Sha1 #12

Closed
opened 2023-11-04 19:37:04 +00:00 by jordan · 0 comments
Owner

When compiling Cytoplasm on Debian in WSL, the following warnings are emitted:

cc -Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -Isrc/include -DTLS_IMPL=TLS_OPENSSL '-DLIB_NAME="Cytoplasm"' '-DLIB_VERSION="0.4.0"'  -fPIC -c -o "build/Sha/Sha1.o" "src/Sha/Sha1.c"
In function ‘Sha1Update’,
    inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:230:5,
    inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5:
src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 1 [-Wstringop-overread]
  205 |             Sha1Transform(ctx->state, (UInt8 *) buf + i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’}
src/Sha/Sha1.c: In function ‘Sha1’:
src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’
   64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64])
      | ^~~~~~~~~~~~~
In function ‘Sha1Update’,
    inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:233:9,
    inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5:
src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 1 [-Wstringop-overread]
  205 |             Sha1Transform(ctx->state, (UInt8 *) buf + i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’}
src/Sha/Sha1.c: In function ‘Sha1’:
src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’
   64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64])
      | ^~~~~~~~~~~~~
In function ‘Sha1Update’,
    inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:236:5,
    inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5:
src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 7 [-Wstringop-overread]
  205 |             Sha1Transform(ctx->state, (UInt8 *) buf + i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’}
src/Sha/Sha1.c: In function ‘Sha1’:
src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’
   64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64])
      | ^~~~~~~~~~~~~

Compiler:

cc --version
cc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
When compiling Cytoplasm on Debian in WSL, the following warnings are emitted: ``` cc -Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -Isrc/include -DTLS_IMPL=TLS_OPENSSL '-DLIB_NAME="Cytoplasm"' '-DLIB_VERSION="0.4.0"' -fPIC -c -o "build/Sha/Sha1.o" "src/Sha/Sha1.c" In function ‘Sha1Update’, inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:230:5, inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5: src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 1 [-Wstringop-overread] 205 | Sha1Transform(ctx->state, (UInt8 *) buf + i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’} src/Sha/Sha1.c: In function ‘Sha1’: src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’ 64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64]) | ^~~~~~~~~~~~~ In function ‘Sha1Update’, inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:233:9, inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5: src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 1 [-Wstringop-overread] 205 | Sha1Transform(ctx->state, (UInt8 *) buf + i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’} src/Sha/Sha1.c: In function ‘Sha1’: src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’ 64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64]) | ^~~~~~~~~~~~~ In function ‘Sha1Update’, inlined from ‘Sha1Calculate’ at src/Sha/Sha1.c:236:5, inlined from ‘Sha1’ at src/Sha/Sha1.c:262:5: src/Sha/Sha1.c:205:13: warning: ‘Sha1Transform’ reading 64 bytes from a region of size 7 [-Wstringop-overread] 205 | Sha1Transform(ctx->state, (UInt8 *) buf + i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/Sha/Sha1.c:205:13: note: referencing argument 2 of type ‘const UInt8[64]’ {aka ‘const unsigned char[64]’} src/Sha/Sha1.c: In function ‘Sha1’: src/Sha/Sha1.c:64:1: note: in a call to function ‘Sha1Transform’ 64 | Sha1Transform(UInt32 state[5], const UInt8 buffer[64]) | ^~~~~~~~~~~~~ ``` Compiler: ``` cc --version cc (Debian 12.2.0-14) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ```
jordan added the
bug
label 2023-11-04 19:37:04 +00:00
jordan added this to the Cytoplasm v0.4.1 milestone 2023-12-02 15:27:12 +00:00
jordan referenced this issue from a commit 2024-01-13 22:13:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Telodendria/Cytoplasm#12
No description provided.