Fix hh_server naming crash
commitb2cf752550c913a6e775abf574cae260d7c4db8b
authorJames Wu <jjwu@fb.com>
Thu, 19 Jul 2018 21:23:19 +0000 (19 14:23 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 19 Jul 2018 21:28:04 +0000 (19 14:28 -0700)
tree0c7e83f9ca3135e3d30e753d7455d5e6fc53faa3
parent63291f4a3e915e1b2c63c7444d78ddc54ef45b3f
Fix hh_server naming crash

Summary:
We crash when exposed to this code in incremental mode:

```
<?hh

function foo : void {
  try {
 } catch(e) { // no dollar sign!
  }
}
```

This diff fixes the index out of bounds by bounds checking the string first.

There are a few more instances of .[0] in naming, but none of them seem to trigger crashes, so I won't be editing them for now.

Reviewed By: dabek

Differential Revision: D8921446

fbshipit-source-id: f286d962912163aff134d00f1b06b01d33438ccf
hphp/hack/src/naming/naming.ml