Skip to content
  • Olivier Fourdan's avatar
    glamor: avoid a crash if texture allocation failed · 8805a48e
    Olivier Fourdan authored and Emma Anholt's avatar Emma Anholt committed
    Texture creation in _glamor_create_tex() can fail if a GL_OUT_OF_MEMORY
    is raised, in which case the texture returned is zero.
    
    But the texture value is not checked in glamor_create_fbo() and glamor
    will abort in glamor_pixmap_ensure_fb() because the fbo->tex is 0:
    
      Truncated backtrace:
      Thread no. 1 (10 frames)
       #4 glamor_pixmap_ensure_fb at glamor_fbo.c:57
       #5 glamor_create_fbo_from_tex at glamor_fbo.c:112
       #6 glamor_create_fbo at glamor_fbo.c:159
       #7 glamor_create_fbo_array at glamor_fbo.c:210
       #8 glamor_create_pixmap at glamor.c:226
       #9 compNewPixmap at compalloc.c:536
       #10 compAllocPixmap at compalloc.c:605
       #11 compCheckRedirect at compwindow.c:167
       #12 compRealizeWindow at compwindow.c:267
       #13 RealizeTree at window.c:2617
    
    Check the value returned by _glamor_create_tex() in glamor_create_fbo()
    and return NULL in the texture is zero.
    
    All callers of glamor_create_fbo() actually check the returned value and
    will use a fallback code path if it's NULL.
    
    Please cherry-pick this to active stable branches.
    
    Bugzilla: https://bugzilla.redhat.com/1433305
    
    
    Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
    Reviewed-by: default avatarEric Anholt <eric@anholt.net>
    8805a48e