and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

Check ASN1_item_ndef_i2d() return value.

Return an error instead of trying to malloc a negative number.
The other usage in this file already had a similar check, and the caller
should have put an entry on the error stack already.

Note that we only check the initial calls to obtain the encoded length,
and assume that the follow-up call to actually encode to the allocated
storage will succeed if the first one did.

Fixes: #14177

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14308)

(cherry picked from commit 90b4247c)
22 jobs for master in 0 seconds (queued for 98 minutes and 2 seconds)
Status Job ID Name Coverage
  Build
failed #3294
build

 
  Test
skipped #3305
allowed to fail
bandit-sast
skipped #3306
allowed to fail
brakeman-sast
skipped #3302
allowed to fail
bundler-audit-dependency_scanning
failed #3297
allowed to fail
code_intelligence_go

failed #3296
allowed to fail
code_quality

skipped #3298
allowed to fail
container_scanning
skipped #3307
allowed to fail
eslint-sast
skipped #3308
allowed to fail
flawfinder-sast
skipped #3299
allowed to fail
gemnasium-dependency_scanning
skipped #3300
allowed to fail
gemnasium-maven-dependency_scanning
skipped #3301
allowed to fail
gemnasium-python-dependency_scanning
skipped #3309
allowed to fail
gosec-sast
skipped #3304
allowed to fail
license_scanning
skipped #3310
allowed to fail
nodejs-scan-sast
skipped #3311
allowed to fail
phpcs-security-audit-sast
skipped #3312
allowed to fail
pmd-apex-sast
skipped #3303
allowed to fail
retire-js-dependency_scanning
skipped #3315
allowed to fail
secret_detection
skipped #3313
allowed to fail
security-code-scan-sast
skipped #3314
allowed to fail
spotbugs-sast
failed #3295
test

 
Name Stage Failure
failed
code_quality Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
test Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
code_intelligence_go Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
build Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log