<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/129641>129641</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Rewriter::InsertTextAfterToken may have overflow issue
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          shafik
      </td>
    </tr>
</table>

<pre>
    If we look at `Rewriter::InsertTextAfterToken`, we see that here: 

https://github.com/llvm/llvm-project/blob/3aab3fe56fbd60b49a47ae0f90d96de2cd09fc18/clang/lib/Rewrite/Rewriter.cpp#L204-L205

`getRangeSize` may return a `-1` which could lead to an overflow and would likely not be a good value when passed to `InsertText`. 

This was flagged by static analysis. It looks like a valid issue but I am not sure. It seems like the function is not used anymore so maybe the correct fix is to remove it.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUks-OmzAQxp_GXEaLjPmzy4FD2ipSpD1t9wUGewA3xo7sIWz69BUkVY5VTyD4vplvZn6Ykh09USfqb6L-keHCU4hdmnCw56wP5tadBlgJXAhnQAbRyA9ao2WKojyI8nDyiSJ_0hcfBqb4Gc7kRSOF-r7ZEhHwhAwTRRLlAYQ8CHmYmC9p86ujUMfR8rT0uQ6zUEfnrn8fL5cYfpFmoY69C71QxxKxLweqm6E3jeyrFqtXJDm00rSNIaWNbAddvAl11A79uBWym_GR-fkWc325CFW-K1m9vCtZ34OJRo7EH-hH-ml_k2gkzHiDSLxED7iN_1JsX9fJ6gl0WJwBR2iAA6CHcKU4uLACegPr_a89k7uBDww9AcIYgoEruoVgncjDBVOi3S8a-dymaGT-2NbnZBOsmGBwOI5koL9BYmSrAT26W7IphxPvN0p7P8CtgzVgU1oI-oXhBDjvIdISaZcnovkh54lgWLxmGzzYtOuWLRX62xwiQQrbHvq7UocYSTMM9msTc4BIc7gSWM4z05WmLVvMqCteq0I2ddG02dTpFqmWhdYlKlmYehjwraZWDapoZVHJzHZKqlqWspJ1oao2b16VqfuqbU2tdVW_iUrSjNblGxt5iGO2T9cVqm2qInPYk0s7yEp5Wu-zC6U2rmO3A9UvYxKVdDZxepZhy466f2O9ozDhlZ5n3ntkS3TdfyO9W5NQx0f-a6f-BAAA__8jjStu">