Skip to content

Commit 511555b

Browse files
authored
Merge pull request #162 from struct/tags_12_3_22
Comment and null ptr checks
2 parents 59ac285 + 1afaf02 commit 511555b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ SECURITY_FLAGS = -DSANITIZE_CHUNKS=0 -DFUZZ_MODE=0 -DPERM_FREE_REALLOC=0 -DDISAB
1414

1515
## Enable memory tagging support. This will generate a random
1616
## 1 byte tag per addressable chunk of memory. These tags can
17-
## be retrieved and verified
17+
## be retrieved and verified. This feature will likely interfere
18+
## with ARM MTE and PAC. See MEMORY_TAGGING.md for more information
1819
MEMORY_TAGGING = -DMEMORY_TAGGING=0
1920

2021
## Enable abort() when isoalloc can't gather enough entropy.

src/iso_alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,13 +1464,13 @@ INTERNAL_HIDDEN void iso_free_chunk_from_zone(iso_alloc_zone_t *zone, void *rest
14641464
}
14651465

14661466
INTERNAL_HIDDEN void _iso_free_from_zone(void *p, iso_alloc_zone_t *zone, bool permanent) {
1467-
if(p == NULL) {
1467+
if(p == NULL || zone == NULL) {
14681468
return;
14691469
}
14701470

14711471
#if MEMORY_TAGGING
14721472
/* Its possible that we were passed a tagged pointer */
1473-
if(UNLIKELY(zone != NULL && zone->tagged == true && ((uintptr_t) p & IS_TAGGED_PTR_MASK) != 0)) {
1473+
if(UNLIKELY(zone->tagged == true && ((uintptr_t) p & IS_TAGGED_PTR_MASK) != 0)) {
14741474
/* If the untagging results in a bad pointer we
14751475
* will catch it in the free path and abort */
14761476
p = _untag_ptr(p, zone);

0 commit comments

Comments
 (0)