OpenAFS Master Repository branch, openafs-stable-1_8_x, updated. openafs-stable-1_8_13_2-41-g6f8c509

Gerrit Code Review gerrit@openafs.org
Thu, 15 May 2025 12:41:01 -0400


The following commit has been merged in the openafs-stable-1_8_x branch:
commit 6f8c5093a4f82b627277f1291071667bef53f0d3
Author: Marcio Barbosa <mbarbosa@sinenomine.net>
Date:   Thu Nov 21 06:05:12 2024 -0800

    DARWIN: Use NSUInteger for indexGreaterThanIndex return value
    
    The indexGreaterThanIndex function returns the closest index from the
    index set that is greater than a specified index. This function is
    typically used in a loop to iterate through a list of items until it
    returns NSNotFound, indicating the end of the list.
    
    In AFSCommanderPref.m, the following pattern is being used:
    
    int index = 0;
    do {
        ...
    } while((index = [... indexGreaterThanIndex:index]) != NSNotFound);
    
    The issue arises because indexGreaterThanIndex returns an NSUInteger,
    while the loop uses an int for index. If NSNotFound is cast to an int,
    it becomes -1, causing the loop to never terminate and leading to a
    crash.
    
    To fix this problem, change the type of index from int to NSUInteger to
    ensure proper comparison and termination of the loop when NSNotFound is
    returned.
    
    Reviewed-on: https://gerrit.openafs.org/15961
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
    Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    (cherry picked from commit d76df7cb24a7d5c12dcbe2a60cf34d1a6f158c76)
    
    Change-Id: I270bdf5fefbb32062e56e2e6f3908669738ef819
    Reviewed-on: https://gerrit.openafs.org/16067
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
    Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

 src/platform/DARWIN/AFSPreference/AFSCommanderPref.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
OpenAFS Master Repository