From simon.urbanek at r-project.org  Tue Jul 19 20:09:58 2005
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Tue, 19 Jul 2005 14:09:58 -0400
Subject: [Rd] segfault with grid and null unit (PR#8014)
In-Reply-To: <20050719103940.DE0B3A6FD@slim.kubism.ku.dk>
References: <20050719103940.DE0B3A6FD@slim.kubism.ku.dk>
Message-ID: <7FCAAF89-0CE2-47C2-B23D-A2BBAAEA768C@r-project.org>

On Jul 19, 2005, at 6:39 AM, jp-www at dcs.gla.ac.uk wrote:

> Sourcing this code causes the R GUI to crash. I've enclosed a  
> partial backtrace
> from the crash below.

I can confirm that this crashes both on OS X (current R-devel) and  
Linux (2.1.1). The detailed stack trace (with debug symbols) from OS  
X follows.

However, I can't find any documentation on "null" units (?unit  
doesn't mention them), so I wonder whether this is just a missing  
sanity check or something more profound ...

#0  Rf_isObject (s=0x68000001) at ../../../../R-devel/src/main/util.c: 
616
#1  0x003060e4 in Rf_inherits (s=0x68000001, name=0x966ad80  
"unit.arithmetic") at ../../../../R-devel/src/main/util.c:624
#2  0x096651b8 in pureNullUnit (unit=0x68000001, index=0,  
dd=0x113eff0) at ../../../../../../R-devel/src/library/grid/src/ 
unit.c:270
#3  0x096651fc in pureNullUnit (unit=0x10ff78e8, index=2,  
dd=0x113eff0) at ../../../../../../R-devel/src/library/grid/src/ 
unit.c:273
#4  0x09662768 in findRelWidths (layout=0x108d7528,  
relativeWidths=0x11b0b4f8, dd=0x113eff0) at ../../../../../../R-devel/ 
src/library/grid/src/layout.c:70
#5  0x09663720 in calcViewportLayout (viewport=0x10bfad60,  
parentWidthCM=12.699999999999999, parentHeightCM=12.699999999999999,  
parentContext={xscalemin = 0, xscalemax = 1, yscalemin = 0, yscalemax  
= 1}, parentgc=0xbfff76f0, dd=0x113eff0) at ../../../../../../R-devel/ 
src/library/grid/src/layout.c:463
#6  0x09669888 in calcViewportTransform (vp=0x10bfad60,  
parent=0x10c6af38, incremental=3221190720, dd=0x113eff0)  
at ../../../../../../R-devel/src/library/grid/src/viewport.c:351
#7  0x0965cefc in doSetViewport (vp=0x10bfad60, topLevelVP=157724032,  
pushing=281456440, dd=0x113eff0) at ../../../../../../R-devel/src/ 
library/grid/src/grid.c:185
#8  0x0965d40c in L_setviewport (vp=0x10bfad60, hasParent=0x10d4da68)  
at ../../../../../../R-devel/src/library/grid/src/grid.c:302
#9  0x0024a0b0 in do_dotcall (call=0x119008d8, op=0x966ad80,  
args=0x18681b0, env=0x80808080) at ../../../../R-devel/src/main/ 
dotcode.c:788
#10 0x0024da14 in do_dotcallgr (call=0x119008d8, op=0x18c5794,  
args=0x11902244, env=0x11900ccc) at ../../../../R-devel/src/main/ 
dotcode.c:1468
#11 0x00264964 in Rf_eval (e=0x119008d8, rho=0x11900ccc)  
at ../../../../R-devel/src/main/eval.c:405

Cheers,
Simon


> ==============
> require(grid)
>
> sometext = "hello there\nthis is a \ntest!"
>
> pushViewport(
>         viewport(
>                 layout=grid.layout(1,3,
>                         widths=unit.c(
>                                 unit(1,"strwidth",sometext) +
>                                 unit(2,"cm"),
>                                 unit(1,"null")
>                         )
>                 )
>         )
> )
> ==============
>
> Date/Time:      2005-07-19 11:35:30.950 +0100
> OS Version:     10.4.2 (Build 8C46)
> Report Version: 3
>
> Command: R
> Path:    /Volumes/George/MyApplications/R.app/Contents/MacOS/R
> Parent:  WindowServer [146]
>
> Version: 1.12 (1622)
>
> PID:    10493
> Thread: 0
>
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x68000001
>
> Thread 0 Crashed:
> 0   libR.dylib                   0x00303d1c Rf_isObject + 0 (util.c: 
> 623)
> 1   grid.so                      0x060c6240 pureNullUnit + 40  
> (unit.c:270)
> 2   grid.so                      0x060c6284 pureNullUnit + 108  
> (unit.c:273)
> 3   grid.so                      0x060c3894 findRelWidths + 60  
> (layout.c:69)
> 4   grid.so                      0x060c484c calcViewportLayout + 172
> (layout.c:464)
> 5   grid.so                      0x060ca888 calcViewportTransform +  
> 1296
> (viewport.c:356)
> 6   grid.so                      0x060be0a0 doSetViewport + 256  
> (grid.c:200)
> 7   grid.so                      0x060be5ac L_setviewport + 76  
> (grid.c:311)
> 8   libR.dylib                   0x00249318 do_dotcall + 652  
> (dotcode.c:770)
> 9   libR.dylib                   0x0024cc7c do_dotcallgr + 80  
> (dotcode.c:1450)
> 10  libR.dylib                   0x00263b24 Rf_eval + 1536 (eval.c: 
> 405)
> 11  libR.dylib                   0x00265b1c do_set + 224 (eval.c:1309)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>



[Rd] segfault with grid and null unit (PR#8014)
Simon Urbanek