diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 779f1fd6f..574e13aa2 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2941,13 +2941,20 @@ void WasmBinaryReader::readSourceMapHeader() { // investigation (if it does, it will assert in readBase64VLQ, so it // would not be a silent error at least). uint32_t position = readBase64VLQ(*sourceMap); - uint32_t fileIndex = readBase64VLQ(*sourceMap); - uint32_t lineNumber = - readBase64VLQ(*sourceMap) + 1; // adjust zero-based line number - uint32_t columnNumber = readBase64VLQ(*sourceMap); nextDebugPos = position; - nextDebugLocation = {fileIndex, lineNumber, columnNumber}; - nextDebugLocationHasDebugInfo = true; + + auto peek = sourceMap->peek(); + if (peek == ',' || peek == '\"') { + // This is a 1-length entry, so the next location has no debug info. + nextDebugLocationHasDebugInfo = false; + } else { + uint32_t fileIndex = readBase64VLQ(*sourceMap); + uint32_t lineNumber = + readBase64VLQ(*sourceMap) + 1; // adjust zero-based line number + uint32_t columnNumber = readBase64VLQ(*sourceMap); + nextDebugLocation = {fileIndex, lineNumber, columnNumber}; + nextDebugLocationHasDebugInfo = true; + } } void WasmBinaryReader::readNextDebugLocation() { |