elftools: StringTableSection: Check table size before returning string

Some ELF files have strings pointing to an offset outside the string
table dimension, let's throw an exception in that case.

TEST=sudo /mnt/host/source/chromite/bin/test_image --board edgar \
     => Succeeds
TEST=sudo /mnt/host/source/chromite/bin/test_image --board edgar \
     => Fails with a clearer error message than currently

Change-Id: Id6919d29f5f4c14f03b11ff540adf63dc1fe9c6f
Reviewed-on: https://chromium-review.googlesource.com/792553
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
1 file changed