Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays::getLength: include 'from' in exception message #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Artox
Copy link

@Artox Artox commented Oct 7, 2017

Explicitly pass 'from' as String to the constructor of ByteBuffer
to avoid interpreting it as initial buffer capacity.

Use append to add 'from' value to the ByteBuffer.
This avoids accidentally interpreting it as initial buffer capacity in the constructor.

Signed-off-by: Josua Mayer <josua.mayer97@gmail.com>
Throw IllegalArgumentException if from > to (newLength < 0).

Signed-off-by: Josua Mayer <josua.mayer97@gmail.com>
@Artox
Copy link
Author

Artox commented Oct 7, 2017

careful about the second commit, it would be better off in its own pr.

I don't know how much error handling you want to include in Arrays class. The check I added here could go into all copyOfRange methods!
So this check just causes an exception to be thrown one step earlier in the call-stack.
More precisely, if all copyOfRange methods contained such a check, the one in getLength() may never again trigger.

@dschuermann
Copy link
Member

@Artox Are you sure that you wanted to do this PR against our bouncy castle fork? The main repo is here: https://github.com/bcgit/bc-java

@dschuermann
Copy link
Member

I just saw your comment here: open-keychain/open-keychain#1936 (comment)

Is this PR related? Please explain what you are trying to fix.

ShellWen pushed a commit to ShellWen/bouncycastle that referenced this pull request Jun 29, 2022
Added new constructor to ASN1EncodableVector that takes array of ASN1Encodables.
Updated ExtensionGenerator to match C# equivalent.
Added method to extract extensions from PKCS10CertificationRequest
Added tests
ShellWen pushed a commit to ShellWen/bouncycastle that referenced this pull request Jun 29, 2022
moved [] constructor to addAll method in ASN1EncodableVector
ShellWen pushed a commit to ShellWen/bouncycastle that referenced this pull request Jun 29, 2022
PGP{Public|Secret}KeyRingCollection: Ignore marker packets when reading.

open-keychain#1
Merged PR from GitHub, updated contributors, fixed formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants