Skip to content

shift exponent too large in left shift #544

Closed
@mgudemann

Description

@mgudemann

when supplying a carefully crafted GOTO, it is possible to have a left shift showing potentially undefined behavior, as more than bit-width bits are left shifted

  while(in.good())
  {
    unsigned char ch=in.get();
    res|=(size_t(ch&0x7f))<<shift_distance;
    shift_distance+=7;
    if((ch&0x80)==0) break;
  }

wrong_left_shift.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions