File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,8 @@ copyabletopsegment(G *gp)
344
344
if (d -> argp < cinfo .stk || cinfo .base <= d -> argp )
345
345
break ; // a defer for the next segment
346
346
fn = d -> fn ;
347
+ if (fn == nil ) // See issue 8047
348
+ continue ;
347
349
f = runtime·findfunc ((uintptr )fn -> fn );
348
350
if (f == nil )
349
351
return -1 ;
@@ -552,13 +554,19 @@ adjustdefers(G *gp, AdjustInfo *adjinfo)
552
554
}
553
555
if (d -> argp < adjinfo -> oldstk || adjinfo -> oldbase <= d -> argp )
554
556
break ; // a defer for the next segment
555
- f = runtime·findfunc ((uintptr )d -> fn -> fn );
557
+ fn = d -> fn ;
558
+ if (fn == nil ) {
559
+ // Defer of nil function. It will panic when run, and there
560
+ // aren't any args to adjust. See issue 8047.
561
+ d -> argp += adjinfo -> delta ;
562
+ continue ;
563
+ }
564
+ f = runtime·findfunc ((uintptr )fn -> fn );
556
565
if (f == nil )
557
566
runtime·throw ("can't adjust unknown defer" );
558
567
if (StackDebug >= 4 )
559
568
runtime·printf (" checking defer %s\n" , runtime·funcname (f ));
560
569
// Defer's FuncVal might be on the stack
561
- fn = d -> fn ;
562
570
if (adjinfo -> oldstk <= (byte * )fn && (byte * )fn < adjinfo -> oldbase ) {
563
571
if (StackDebug >= 3 )
564
572
runtime·printf (" adjust defer fn %s\n" , runtime·funcname (f ));
You can’t perform that action at this time.
0 commit comments