• Keith Randall's avatar
    cmd/compile: pad zero-sized stack variables · c5414457
    Keith Randall authored
    If someone takes a pointer to a zero-sized stack variable, it can
    be incorrectly interpreted as a pointer to the next object in the
    stack frame. To avoid this, add some padding after zero-sized variables.
    
    We only need to pad if the next variable in memory (which is the
    previous variable in the order in which we allocate variables to the
    stack frame) has pointers. If the next variable has no pointers, it
    won't hurt to have a pointer to it.
    
    Because we allocate all pointer-containing variables before all
    non-pointer-containing variables, we should only have to pad once per
    frame.
    
    Fixes #24993
    
    Change-Id: Ife561cdfdf964fdbf69af03ae6ba97d004e6193c
    Reviewed-on: https://go-review.googlesource.com/c/155698
    Run-TryBot: Keith Randall <khr@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    c5414457
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...