classObjectIdentifiers
final class ObjectIdentifiers
Checks the numbers of GRANT and REVOKE ON LARGE OBJECT as object identifiers.
Rule: PG-LARGE-OBJECT-OID-001. The server reads each number with oidparse(): an integer constant, which fits int4, is taken as it is (a negative one wraps around); a numeric constant keeps its written text, and the text with its sign is read as an unsigned 32-bit integer by uint32in_subr(), which calls strtoul() with base 0. That reads decimal digits, hexadecimal digits after 0x and octal digits after a leading zero; any other text, such as a fraction, an exponent, digit separators or the 0o and 0b prefixes, is "invalid input syntax for type oid", and a value beyond 4294967295 is "value … is out of range for type oid"; of the negative values outside int4 only -2147483648 passes, because only it matches after sign extension. Whether a large object exists is not a declaration a context holds and is not reported. Termination: one pass over a finite list. Source: https://www.postgresql.org/docs/17/sql-grant.html, https://www.postgresql.org/docs/17/datatype-oid.html. Status: Implemented.
Methods§
public function check(Derivation $derivation, list<SignedNumber> $identifiers): voidReports every number that is no object identifier.
Parameters
$derivation | Derivation | |
$identifiers | list<SignedNumber> |
Called from 1
Calls 2
- method-call ObjectIdentifiers::problem() line 55
- method-call Derivation::report() line 57
public function problem(SignedNumber $identifier): ?AccessProblemAnswers the problem of a number read as an object identifier, or null when the server accepts it.
Parameters
$identifier | SignedNumber |
Returns
Test cases 3
Called from 1
Calls 9
- method-call ObjectIdentifiers::unsigned() line 71
- new AccessProblem line 73
- class-const AccessProblemRule::InvalidObjectIdentifier() line 73
- method-call SignedNumber::text() line 73
- method-call Numerals::within() line 76
- new Numerals line 76
- class-const ObjectIdentifiers::NEGATIVE_MAX() line 76
- class-const ObjectIdentifiers::OID_MAX() line 76
- class-const AccessProblemRule::ObjectIdentifierRange() line 76
public function unsigned(string $text): ?stringAnswers the canonical decimal digits strtoul() with base 0 reads from a whole text, or null when it does not read the whole text.
Parameters
$text | string |
Returns
?stringTest cases 2
Called from 1
Calls 5
- new Numerals line 84
- function-call
preg_matchline 87 - method-call Numerals::decimal() line 87
- function-call
substrline 88 - method-call Numerals::canonical() line 89
Private surface 2§
Implementation details, listed for orientation only.
private const OID_MAX = '4294967295'private const NEGATIVE_MAX = '2147483648'Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ObjectIdentifiersTest::testProblemAcceptsEveryIntegerConstantcallsObjectIdentifiersTest::testProblemRejectsANegativeValueBeyondTheSignExtensioncallsObjectIdentifiersTest::testProblemRejectsAValueOfMoreThanTenDigitscallsObjectIdentifiersTest::testUnsignedReadsDecimalHexadecimalAndOctalDigitscallsObjectIdentifiersTest::testUnsignedReadsNothingFromAnyOtherTextcalls