Bug when deactivating skins (with fix proposal)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #35750
    wesson
    Participant

    The TsSpinEdit control suffer from a bug when a skin is deactivated, it may cause a crash and a memory corruption.

    Problem is in the method TsTimerSpeedButton.DrawGlyph, access is made to

    Code:
    SkinData.SkinManager.gd[FOwner.FOwner.SkinData.SkinIndex]

    , however in the context of deactivating skins, the skin index is outside the bounds.

    To fix the issue, in line 1073 of sSpineEdit.pas, replace:

    Code:
    – if (SkinData.SkinIndex > -1) and not FOwner.FOwner.SkinData.CustomFont then begin

    by

    Code:
    + if (SkinData.SkinIndex > -1) and not FOwner.FOwner.SkinData.CustomFont and
    + (High(SkinData.SkinManager.gd) >= FOwner.FOwner.SkinData.SkinIndex) then begin
    #50559
    wesson
    Participant

    Also same issue (out of bound access to dynamic array) occurs when switching between themes (ex: from BlueGauze to BlueGlass).

    For the fix, there is an attached a patch file for sSkinProvider.pas

    There's not a lot of range checks in the code… 😉

    #50560
    Support
    Keymaster

    Thank you, I'll check it soon.

    Btw, sSkinProvider.pas is not attached here 🙂

    #50561
    wesson
    Participant
    'Support' wrote:

    Thank you, I'll check it soon.

    Btw, sSkinProvider.pas is not attached here 🙂

    My mistake, I forgot to push the “attach this file” button.

    It's based on Version 8.34, modifications are in lines 6793, 6827 and 6834

    #50567
    Support
    Keymaster

    Thank you.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.