Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit dd701fb

Browse files
Avoiding arithmetic ops with NULL pointer in nxt_unit_mmap_get
Found by UndefinedBehaviorSanitizer. Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
1 parent c9461a6 commit dd701fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/nxt_unit.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3502,6 +3502,10 @@ nxt_unit_mmap_get(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
35023502

35033503
pthread_mutex_lock(&lib->outgoing.mutex);
35043504

3505+
if (nxt_slow_path(lib->outgoing.elts == NULL)) {
3506+
goto skip;
3507+
}
3508+
35053509
retry:
35063510

35073511
outgoing_size = lib->outgoing.size;
@@ -3598,6 +3602,8 @@ nxt_unit_mmap_get(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
35983602
goto retry;
35993603
}
36003604

3605+
skip:
3606+
36013607
*c = 0;
36023608
hdr = nxt_unit_new_mmap(ctx, port, *n);
36033609

0 commit comments

Comments
 (0)