Skip to content

asn: fix GetShortInt for asn original.#10458

Merged
SparkiDev merged 1 commit into
wolfSSL:masterfrom
philljj:fix_GetShortInt
May 13, 2026
Merged

asn: fix GetShortInt for asn original.#10458
SparkiDev merged 1 commit into
wolfSSL:masterfrom
philljj:fix_GetShortInt

Conversation

@philljj
Copy link
Copy Markdown
Contributor

@philljj philljj commented May 11, 2026

Description

Fix GetShortInt() to return ASN_PARSE_E for zero length with asn=original.

Fixes zd#21783.

Testing

./configure --enable-asn=original && make && ./tests/unit.test
./configure --enable-asn=yes && make && ./tests/unit.test

@philljj philljj self-assigned this May 11, 2026
Copilot AI review requested due to automatic review settings May 11, 2026 19:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes DER INTEGER decoding behavior in GetShortInt() so that a zero-length INTEGER is treated as invalid (returns ASN_PARSE_E) when using the “original” ASN implementation, aligning behavior with GetASN_Integer() and adding a regression test (zd#21783).

Changes:

  • Add a len == 0 check in GetShortInt() (non-template/original ASN path) to return ASN_PARSE_E under the same FIPS/selftest gating used by GetASN_Integer().
  • Add a unit test ensuring a zero-length ASN.1 INTEGER triggers ASN_PARSE_E for GetShortInt() (with matching FIPS/selftest gating).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
wolfcrypt/src/asn.c Rejects zero-length ASN.1 INTEGERs in GetShortInt() (original ASN path) to match strict INTEGER validation behavior.
tests/api/test_asn.c Adds a regression test for zero-length INTEGER handling in GetShortInt().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/api/test_asn.c
@github-actions
Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@philljj
Copy link
Copy Markdown
Contributor Author

philljj commented May 12, 2026

Retest this please.

@philljj philljj assigned wolfSSL-Bot and unassigned philljj May 12, 2026
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10458

Scan targets checked: wolfcrypt-bugs, wolfcrypt-src

No new issues found in the changed files. ✅

@SparkiDev SparkiDev self-assigned this May 13, 2026
@SparkiDev SparkiDev merged commit 58c41b6 into wolfSSL:master May 13, 2026
447 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants