ANDROID: selftests: incfs: Add -fno-omit-frame-pointer
Without it incfs/incfs_perf runtime fails in format_signature: malloc(): invalid size (unsorted) Aborted When compiled with gcc version 11.2.0. Also add check for NULL after the malloc, and remove unneeded space for uint32_t in signing_section. Bug: 211066171 Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org> Change-Id: I62b775140e4b89f75335cbd65665cf6a3e0fe964
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -Werror -I../.. -I../../../../..
|
CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -Werror -I../.. -I../../../../.. -fno-omit-frame-pointer -fsanitize=address -g
|
||||||
LDLIBS := -llz4 -lzstd -lcrypto -lpthread
|
LDLIBS := -llz4 -lzstd -lcrypto -lpthread -fsanitize=address
|
||||||
TEST_GEN_PROGS := incfs_test incfs_stress incfs_perf
|
TEST_GEN_PROGS := incfs_test incfs_stress incfs_perf
|
||||||
|
|
||||||
include ../../lib.mk
|
include ../../lib.mk
|
||||||
|
@@ -116,6 +116,9 @@ size_t format_signature(void **buf, const char *root_hash, const char *add_data)
|
|||||||
size_t size = sizeof(struct signature_blob) + strlen(add_data) + 1;
|
size_t size = sizeof(struct signature_blob) + strlen(add_data) + 1;
|
||||||
struct signature_blob *sb = malloc(size);
|
struct signature_blob *sb = malloc(size);
|
||||||
|
|
||||||
|
if (!sb)
|
||||||
|
return 0;
|
||||||
|
|
||||||
*sb = (struct signature_blob){
|
*sb = (struct signature_blob){
|
||||||
.version = INCFS_SIGNATURE_VERSION,
|
.version = INCFS_SIGNATURE_VERSION,
|
||||||
.hash_section_size = sizeof(struct hash_section),
|
.hash_section_size = sizeof(struct hash_section),
|
||||||
@@ -126,7 +129,7 @@ size_t format_signature(void **buf, const char *root_hash, const char *add_data)
|
|||||||
.salt_size = 0,
|
.salt_size = 0,
|
||||||
.hash_size = SHA256_DIGEST_SIZE,
|
.hash_size = SHA256_DIGEST_SIZE,
|
||||||
},
|
},
|
||||||
.signing_section_size = sizeof(uint32_t) + strlen(add_data) + 1,
|
.signing_section_size = strlen(add_data) + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
memcpy(sb->hash_section.hash, root_hash, SHA256_DIGEST_SIZE);
|
memcpy(sb->hash_section.hash, root_hash, SHA256_DIGEST_SIZE);
|
||||||
|
Reference in New Issue
Block a user