RFR(S): 8192978: Missing checks and small fixes in jdwp library
Langer, Christoph
christoph.langer at sap.com
Fri Dec 8 13:48:37 UTC 2017
Hi,
this is a new webrev for 8192978. This change now only contains the coverity fixes.
In detail:
src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c, static void writePaths(PacketOutputStream *out, char *string):
strchr could be called with NULL argument because of assignment pos = psPos; in line 856 (last line of for loop). Proposal: check pos for NULL in head of for loop
src/jdk.jdwp.agent/share/native/libjdwp/error_messages.c, static void vprint_message(FILE *fp, const char *prefix, const char *suffix, const char *format, va_list ap):
potentially unterminated vsnprintf call. Proposal: terminate
src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c, static jboolean synthesizeUnloadEvent(void *signatureVoid, void *envVoid):
checking eventBag for NULL and then calling JDI_ASSERT only in that case is a bit dubious.
It leads the coverity code scan tool to think that eventBag might be NULL when eventHelper_recordClassUnload is called
which would eventually try to dereference a NULL eventbag and hence crash.
Proposal: remove the NULL check but unconditionally assert.
This is the real fix for the changes in eventHelper.c in my former webrev.
src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c, void log_message_end(const char *format, ...):
potentially unterminated vsnprintf call. Proposal: terminate
Furthermore I have 2 whitespace changes which I'd like to see because they would help me reducing the diff to our codebase and, furthermore, make the code looking nicer... a little ;-)
Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8192978.2/
Bug: https://bugs.openjdk.java.net/browse/JDK-8192978
I'm doing builds on the main platform and running jtreg tests.
Thanks in advance & Best regards
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20171208/71174f21/attachment.html>
More information about the serviceability-dev
mailing list