View Issue Details

IDProjectCategoryView StatusLast Update
0001027bareos-core[All Projects] directorpublic2019-11-11 22:57
ReportergnifAssigned To 
PriorityurgentSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSDebianOS Version9
Product Version18.4.1 
Target VersionFixed in Version 
Summary0001027: 32bit integer overflow in sql LIMIT clause
DescriptionRunning backups on the director is producing the following errors, it is clearly a 32-bit integer overflow as the limit has become negative. I believe the issue is in SetQueryRange as it doesn't support parsing or using 64 bit integers.

https://github.com/bareos/bareos/blob/1c5bf440cdc8fe949ba58357d16588474cd6ccb8/core/src/dird/ua_output.cc#L497
Additional Information09-Nov 21:00 bareos-dir JobId 0: Fatal error: cats/sql_list.cc:566 cats/sql_list.cc:566 query SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Level, Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, Job.EndTime, Job.RealEndTime, Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, Pool.Name as PoolName, Job.PriorJobId, Job.FileSetId, FileSet.FileSet FROM Job LEFT JOIN Client ON Client.ClientId=Job.ClientId LEFT JOIN Pool ON Pool.PoolId=Job.PoolId LEFT JOIN JobMedia ON JobMedia.JobId=Job.JobId LEFT JOIN Media ON JobMedia.MediaId=Media.MediaId LEFT JOIN FileSet ON FileSet.FileSetId=Job.FileSetId WHERE Job.JobId > 0 AND Job.JobStatus = 'S' AND Job.SchedTime > '2018-11-08 21:00:21' ORDER BY StartTime LIMIT 1000 OFFSET -2018192296; failed:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2018192296' at line 1
TagsNo tags attached.
bareos-master: impact
bareos-master: action
bareos-18.2: impact
bareos-18.2: action
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impact
bareos-14.2: action
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action

Activities

joergs

joergs

2019-11-11 19:33

administrator   ~0003623

When does this error occur? How have you triggered this SQL query?
gnif

gnif

2019-11-11 22:57

reporter   ~0003625

Simply by allowing BareOS to run backups across multiple servers for several months. There are clearly over 2,147,483,647 records in the result set.

Issue History

Date Modified Username Field Change
2018-11-09 11:51 gnif New Issue
2019-11-11 19:33 joergs Status new => feedback
2019-11-11 19:33 joergs Note Added: 0003623
2019-11-11 22:57 gnif Note Added: 0003625
2019-11-11 22:57 gnif Status feedback => new