RFR: 8247732: validate user-input intrinsic_ids in ControlIntrinsic

Nils Eliasson neliasso at openjdk.java.net
Fri Nov 20 08:51:06 UTC 2020


On Thu, 12 Nov 2020 06:02:34 GMT, Xin Liu <xliu at openjdk.org> wrote:

> 8247732: validate user-input intrinsic_ids in ControlIntrinsic

src/hotspot/share/compiler/compilerDirectives.hpp line 198:

> 196:       if (vmIntrinsics::_none == vmIntrinsics::find_id(*iter)) {
> 197:         _bad = NEW_C_HEAP_ARRAY(char, strlen(*iter) + 1, mtCompiler);
> 198:         strncpy(_bad, *iter, strlen(*iter) + 1);

This doesn't compile. Using strlen as an argument to strncpy is disallowed.

> "warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound depends on the length of the source argument [-Wstringop-overflow=]"

Do a min between strlen and the maximum allowed length.

Fix this for both uses of the string length (row 197 and 198).

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

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


More information about the hotspot-compiler-dev mailing list