Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Snippets
  • Register
  • Sign in
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,359
    • Issues 1,359
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 72
    • Merge requests 72
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPCFPC
  • FPC SourceFPC Source
  • Issues
  • #39938
Closed
Open
Issue created Oct 04, 2022 by Bart B@flyingsheep🐞

[Patch] Fix crash in MaskUtils FormatMaskText if Value is empty string

The following example crashes:

uses
  maskutils;

var
  Value, EditMask, Res: String;
begin
  Value := '';
  EditMask := '#-###-###-##-##;0;_';
  Res := FormatMaskText(EditMask, Value);
  writeln('Res = "',Res,'"');
end.

This is because in TMaskUtils.ApplyMaskToText Value[1] (and Value[0]) is accessed in the loop before there is a length check.

Reported on the forum: https://forum.lazarus.freepascal.org/index.php/topic,60803.0.html

Attached patch fixes the issue. maskutils.diff

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking