Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-38696

my_copy() can cause infinite loop

    XMLWordPrintable

Details

    • Not for ES Release Notes
    • Fixes infinite loop when my_copy fails.

    Description

      Take a look at the following code in my_copy():

         while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0)        
          {                                                                           
              if (Count == (uint) -1 ||                                             
                  my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP)))                
              goto err;                                                               
          } 
      

      That (uint) is wrong, because Count is of size_t type. That causes infinite loop. The code is checked in 11.8, but I am quite sure it exists in earlier versions.

      Attachments

        Activity

          People

            raghunandan.bhat Raghunandan Bhat
            vlad.lesin Vladislav Lesin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1h 20m
                1h 20m

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.