Index: src/PGResult.m ================================================================== --- src/PGResult.m +++ src/PGResult.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql * * Permission to use, copy, modify, and/or distribute this software for any @@ -56,11 +56,11 @@ return PQntuples(_result); } - (id)objectAtIndex: (size_t)index { - if (index > PQntuples(_result)) + if (index > LONG_MAX || (long)index > PQntuples(_result)) @throw [OFOutOfRangeException exception]; return [PGResultRow pg_rowWithResult: self row: (int)index]; } @end Index: src/PGResultRow.m ================================================================== --- src/PGResultRow.m +++ src/PGResultRow.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql * * Permission to use, copy, modify, and/or distribute this software for any @@ -56,11 +56,11 @@ PGResult *_result; PGresult *_res; int _row, _pos, _count; } -- initWithResult: (PGResult*)result row: (int)row; +- (instancetype)initWithResult: (PGResult*)result row: (int)row; @end @interface PGResultRowKeyEnumerator: PGResultRowEnumerator @end @@ -141,11 +141,11 @@ if (state->extra[0] == 0) { state->extra[0] = 1; state->extra[1] = PQnfields(_res); } - if (count > SIZE_MAX - state->state) + if (count < 0 || (unsigned long)count > SIZE_MAX - state->state) @throw [OFOutOfRangeException exception]; if (state->state + count > state->extra[1]) count = state->extra[1] - state->state; Index: src/exceptions/PGException.m ================================================================== --- src/exceptions/PGException.m +++ src/exceptions/PGException.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql * * Permission to use, copy, modify, and/or distribute this software for any @@ -30,11 +30,11 @@ + (instancetype)exceptionWithConnection: (PGConnection *)connection { return [[[self alloc] initWithConnection: connection] autorelease]; } -- initWithConnection: (PGConnection *)connection +- (instancetype)initWithConnection: (PGConnection *)connection { self = [super init]; @try { _connection = [connection retain]; Index: tests/Tests.m ================================================================== --- tests/Tests.m +++ tests/Tests.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql * * Permission to use, copy, modify, and/or distribute this software for any