jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8282578: AIOOBE in javax.sound.sampled.Clip

Open azuev-java opened this issue 3 years ago • 11 comments
trafficstars

Add try/catch clause to ignore an exception since it is harmless for we isolated the massge data before passing it ro processor. Add test case.


Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9016/head:pull/9016
$ git checkout pull/9016

Update a local copy of the PR:
$ git checkout pull/9016
$ git pull https://git.openjdk.org/jdk pull/9016/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9016

View PR using the GUI difftool:
$ git pr show -t 9016

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9016.diff

azuev-java avatar Jun 03 '22 15:06 azuev-java

:wave: Welcome back kizune! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Jun 03 '22 15:06 bridgekeeper[bot]

@azuev-java The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Jun 03 '22 15:06 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jun 03 '22 15:06 mlbridge[bot]

@azvegint @prrace please review

victordyakov avatar Jun 03 '22 16:06 victordyakov

Probably it is better to check the data length for each sys message and discard it if the data is too small? Ignoring all possible AIOOBE from this large method which calls many other large methods from SoftVoice/SoftTuning may hide some other bugs.

mrserb avatar Jun 03 '22 21:06 mrserb

@azuev-java This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8282578: AIOOBE in javax.sound.sampled.Clip

Reviewed-by: prr, aivanov, azvegint

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 201 new commits pushed to the master branch:

  • 8b69a2e434ad2fa3369079622b57afb973d5bd9a: 8298099: [JVMCI] decouple libgraal from JVMCI module at runtime
  • 8a9911ef1762ae837e427ec9d91b1399ba33b6e4: 8295803: Console should be usable in jshell and other environments
  • 5d4c71c8bd361af78c90777f17b79e95d8eb5afe: 8281236: (D)TLS key exchange named groups
  • 10356e767a44632c5de142d4666bd85d4618bf71: 8298303: (fs) temporarily remove Path.getExtension
  • 3b8c7ef8e705764942c4f3df872e3e47021a37f4: 8157023: Integrate NMT with JFR
  • e86f31b5e71af00fea9cd989a86c1e75e3df1821: 8298301: C2: assert(main_cmp->in(2)->Opcode() == Op_Opaque1) failed: main loop has no opaque node?
  • 8edb98df3dd393103f2c80e929b011bc6b7993a3: 8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.
  • 39344840c7a5fbd37f6c6a972a89c3600396e878: 8298205: Prefer Member Initialization Lists for JFR classes in os_perf.hpp
  • 389b8f4b788375821a8bb4b017e50f905abdad2d: 8297298: SequenceInputStream should override transferTo
  • dd7385d1e86afe8af79587e80c5046af5c84b5cd: 8298202: [AIX] Dead code elimination removed jfr constructor used by AIX
  • ... and 191 more: https://git.openjdk.org/jdk/compare/105d9d75e84a46400f52fafda2ea00c99c14eaf0...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Jun 03 '22 21:06 openjdk[bot]

Probably it is better to check the data length for each sys message and discard it if the data is too small? Ignoring all possible AIOOBE from this large method which calls many other large methods from SoftVoice/SoftTuning may hide some other bugs.

No, because determining the correct length of the message will require basically to parse it all, the correct length could be a 2 bytes or hundreds of bytes - in order to determine we have to process the message completely.

azuev-java avatar Jun 04 '22 13:06 azuev-java

No, because determining the correct length of the message will require basically to parse it all, the correct length could be a 2 bytes or hundreds of bytes - in order to determine we have to process the message completely.

There are 64 usages of data in that method most of them use constants like 1/2/3 and other usages are in the loops, both can be easily checked. There is also code like int[] destinations = new int[(data.length - 7) / 2]; which could cause the NegativeArrayException, or probably some others. It s better to check the out of bands access before access than to have a try/catch block for 300 lines of code.

mrserb avatar Jun 04 '22 20:06 mrserb

@azuev-java This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Jul 03 '22 04:07 bridgekeeper[bot]

pre submit tests failed*

AJ1062910 avatar Jul 04 '22 15:07 AJ1062910

@azuev-java This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Aug 11 '22 11:08 bridgekeeper[bot]

@azuev-java This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Sep 08 '22 12:09 bridgekeeper[bot]

Just uploaded the new version with proper length analysis so would be thankful for the continuation of the review.

azuev-java avatar Dec 04 '22 22:12 azuev-java

/open

azuev-java avatar Dec 04 '22 22:12 azuev-java

@azuev-java This pull request is now open

openjdk[bot] avatar Dec 04 '22 22:12 openjdk[bot]

@azvegint Can you please take a look?

azuev-java avatar Dec 07 '22 06:12 azuev-java

/integrate

azuev-java avatar Dec 08 '22 00:12 azuev-java

Going to push as commit af8fb7eef7188ef762399cfb3faf5c8afd49efa7. Since your change was applied there have been 201 commits pushed to the master branch:

  • 8b69a2e434ad2fa3369079622b57afb973d5bd9a: 8298099: [JVMCI] decouple libgraal from JVMCI module at runtime
  • 8a9911ef1762ae837e427ec9d91b1399ba33b6e4: 8295803: Console should be usable in jshell and other environments
  • 5d4c71c8bd361af78c90777f17b79e95d8eb5afe: 8281236: (D)TLS key exchange named groups
  • 10356e767a44632c5de142d4666bd85d4618bf71: 8298303: (fs) temporarily remove Path.getExtension
  • 3b8c7ef8e705764942c4f3df872e3e47021a37f4: 8157023: Integrate NMT with JFR
  • e86f31b5e71af00fea9cd989a86c1e75e3df1821: 8298301: C2: assert(main_cmp->in(2)->Opcode() == Op_Opaque1) failed: main loop has no opaque node?
  • 8edb98df3dd393103f2c80e929b011bc6b7993a3: 8165943: LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is set.
  • 39344840c7a5fbd37f6c6a972a89c3600396e878: 8298205: Prefer Member Initialization Lists for JFR classes in os_perf.hpp
  • 389b8f4b788375821a8bb4b017e50f905abdad2d: 8297298: SequenceInputStream should override transferTo
  • dd7385d1e86afe8af79587e80c5046af5c84b5cd: 8298202: [AIX] Dead code elimination removed jfr constructor used by AIX
  • ... and 191 more: https://git.openjdk.org/jdk/compare/105d9d75e84a46400f52fafda2ea00c99c14eaf0...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Dec 08 '22 00:12 openjdk[bot]

@azuev-java Pushed as commit af8fb7eef7188ef762399cfb3faf5c8afd49efa7.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Dec 08 '22 00:12 openjdk[bot]

Thank you for removing that large try/catch block. Looks much better.

mrserb avatar Dec 08 '22 22:12 mrserb

Thank you for removing that large try/catch block. Looks much better.

I agree, the code is clearer now.

I started reviewing the updated code but I haven't finished it. It's integrated now.

aivanov-jdk avatar Dec 12 '22 17:12 aivanov-jdk