diff --git a/src/PGResult.m b/src/PGResult.m index ee2a045..fec5f65 100644 --- a/src/PGResult.m +++ b/src/PGResult.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql @@ -58,7 +58,7 @@ - (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]; diff --git a/src/PGResultRow.m b/src/PGResultRow.m index fe57b54..3c367d9 100644 --- a/src/PGResultRow.m +++ b/src/PGResultRow.m @@ -1,5 +1,5 @@ /* - * 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 @@ -58,7 +58,7 @@ convertType(PGresult *res, int column, OFString *string) int _row, _pos, _count; } -- initWithResult: (PGResult*)result row: (int)row; +- (instancetype)initWithResult: (PGResult*)result row: (int)row; @end @interface PGResultRowKeyEnumerator: PGResultRowEnumerator @@ -143,7 +143,7 @@ convertType(PGresult *res, int column, OFString *string) 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]) diff --git a/src/exceptions/PGException.m b/src/exceptions/PGException.m index f76574d..996bc38 100644 --- a/src/exceptions/PGException.m +++ b/src/exceptions/PGException.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024 * Jonathan Schleifer * * https://fossil.nil.im/objpgsql @@ -32,7 +32,7 @@ return [[[self alloc] initWithConnection: connection] autorelease]; } -- initWithConnection: (PGConnection *)connection +- (instancetype)initWithConnection: (PGConnection *)connection { self = [super init]; diff --git a/tests/Tests.m b/tests/Tests.m index 07c4d40..28a77c7 100644 --- a/tests/Tests.m +++ b/tests/Tests.m @@ -1,5 +1,5 @@ /* - * 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