RFR: 8247732: validate user-input intrinsic_ids in ControlIntrinsic [v7]

Nils Eliasson neliasso at openjdk.java.net
Tue Dec 1 21:35:57 UTC 2020


On Thu, 26 Nov 2020 01:47:15 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> 8247732: validate user-input intrinsic_ids in ControlIntrinsic
>
> Xin Liu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - 8247732: validate user-input intrinsic_ids in ControlIntrinsic
>    
>    fix typos in JDK-8256508
>  - 8247732: validate user-input intrinsic_ids in ControlIntrinsic
>    
>    avoid a warning of stringop-overflow
>  - 8247732: validate user-input intrinsic_ids in ControlIntrinsic
>    
>    rebase chagnes to tip. make use of JDK-8256508

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

> 195:     for (ControlIntrinsicIter iter(option, disabled_all); *iter != NULL && _valid; ++iter) {
> 196:       if (vmIntrinsics::_none == vmIntrinsics::find_id(*iter)) {
> 197:         _bad = NEW_C_HEAP_ARRAY(char, strlen(*iter) + 1, mtCompiler);

Hi, 

I wanted something like this:

        size_t len = MIN(strlen(*iter), 64);        // cap len to a value we know is enough for all intrinsic names
        _bad = NEW_C_HEAP_ARRAY(char, len + 1, mtCompiler);
        strncpy(_bad, *iter, len + 1);              // use strncpy to cap copy length

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

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


More information about the hotspot-compiler-dev mailing list