Check shared memory size before allocating it. This will prevent overflow from multiplication. BUG=359454 Review URL: https://codereview.chromium.org/214343006