Fix hangs and segfaults when egregiously long symbol is used.
Check nb instead of length.
Merge pull request #8241 from danluu/symbol_hang

Fix hangs and segfaults when egregiously long symbol is used