RFR: JDK-8261593: Do not use NULL pointer as write buffer parameter in jfrEmergencyDump.cpp write_repository_files

Matthias Baesken mbaesken at openjdk.java.net
Thu Feb 11 14:28:48 UTC 2021


In jfrEmergencyDump.cpp write_repository_files, potentially (when malloc fails) a NULL pointer is passed as second (buffer) parameter to os::write .
This is unwanted, see also the Sonar finding :

https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=cpp&open=AXck7_SvBBG2CXpcnJEx&resolved=false&severities=CRITICAL&types=BUG

bytes_written += (int64_t)os::write(emergency_fd, copy_block, bytes_read - bytes_written);

Sonar reports here : "Null pointer passed as read buffer "copy_block" in call to "write""

-------------

Commit messages:
 - JDK-8261593

Changes: https://git.openjdk.java.net/jdk/pull/2525/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2525&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8261593
  Stats: 5 lines in 1 file changed: 3 ins; 2 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2525.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2525/head:pull/2525

PR: https://git.openjdk.java.net/jdk/pull/2525


More information about the hotspot-jfr-dev mailing list