Skip to content

Commit

Permalink
Merge pull request #2926 from psychocoderHPC/topic-avoidOutOfMemAccess
Browse files Browse the repository at this point in the history
`ExchangeTypeNames` avoid illegal memory access
  • Loading branch information
ax3l authored Mar 19, 2019
2 parents 69e77eb + 3e19311 commit 5bc8743
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/pmacc/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

#include <stdint.h>
#include <stdexcept>
#include <string>


namespace pmacc
Expand Down Expand Up @@ -149,6 +150,9 @@ struct ExchangeTypeNames
{
std::string operator[]( const uint32_t exchange ) const
{
if( exchange >= 27 )
return std::string("unknown exchange type: ") + std::to_string(exchange);

const char* names[27] = {
"none",
"right", "left", "bottom",
Expand Down

0 comments on commit 5bc8743

Please sign in to comment.