## Environments

**OS** : Ubuntu 18.04 5.4.0-150-generic
**Commit** : e97d53c5fcbb604fc36432df4fc117d13558d7fd
**Version** : 1.0.34

## Vulnerability Description

**Affected Tool** : wasm2c
**Affected Version** : <= 1.0.34
**Impact** : Denial of Service

* The 'std::out_of_range' error in wabt 1.0.34 can cause a denial of service or crash via a crafted wasm file.

## PoC
**1. Input File**

[wasm2c-DOS-poc01.zip](https://github.com/WebAssembly/wabt/files/13198284/wasm2c-DOS-poc01.zip)

**2. Reproduce**

```shell
$ ~/wabt/bin/wasm2c wasm2c-DOS-poc01 -o /dev/null
```

**3. Stack Trace**

```shell
$ ~/wabt/bin/wasm2c wasm2c-DOS-poc01 -o /dev/null 
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string_view::substr: __pos (which is 18446744073709551615) > this->size() (which is 9)
Aborted
```
Invalid basic_string_view::substr:__pos() number cause DoS
This is a GitHub Issue
repo:wabt
owner:WebAssembly
Title : Invalid basic_string_view::substr:__pos() number cause DoS
Issue date:

--- start body ---
## Environments

**OS** : Ubuntu 18.04 5.4.0-150-generic
**Commit** : e97d53c5fcbb604fc36432df4fc117d13558d7fd
**Version** : 1.0.34

## Vulnerability Description

**Affected Tool** : wasm2c
**Affected Version** : <= 1.0.34
**Impact** : Denial of Service

* The 'std::out_of_range' error in wabt 1.0.34 can cause a denial of service or crash via a crafted wasm file.

## PoC
**1. Input File**

[wasm2c-DOS-poc01.zip](https://github.com/WebAssembly/wabt/files/13198284/wasm2c-DOS-poc01.zip)

**2. Reproduce**

```shell
$ ~/wabt/bin/wasm2c wasm2c-DOS-poc01 -o /dev/null
```

**3. Stack Trace**

```shell
$ ~/wabt/bin/wasm2c wasm2c-DOS-poc01 -o /dev/null 
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string_view::substr: __pos (which is 18446744073709551615) > this->size() (which is 9)
Aborted
```
--- end body ---
