fix integer overflow in literals decompression, port of the fix in r118

Port of a minimal fix for integer overflow in literals decompression that could cause buffer overrun.

Please review it.

Thanks,