Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
54aec65e
Commit
54aec65e
authored
Apr 05, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a gurad logic for appending oversized data
parent
14ec3adf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/models/ci/job_trace_chunk.rb
app/models/ci/job_trace_chunk.rb
+3
-2
No files found.
app/models/ci/job_trace_chunk.rb
View file @
54aec65e
...
@@ -28,7 +28,7 @@ module Ci
...
@@ -28,7 +28,7 @@ module Ci
end
end
def
set_data
(
value
)
def
set_data
(
value
)
raise
'too much data'
if
value
.
length
>
CHUNK_SIZE
raise
'too much data'
if
value
.
bytesize
>
CHUNK_SIZE
case
case
when
redis?
when
redis?
...
@@ -49,7 +49,8 @@ module Ci
...
@@ -49,7 +49,8 @@ module Ci
def
append
(
new_data
,
offset
)
def
append
(
new_data
,
offset
)
current_data
=
self
.
data
||
""
current_data
=
self
.
data
||
""
raise
'Outside of if data'
if
offset
>
current_data
.
bytesize
raise
'Offset is out of bound'
if
offset
>
current_data
.
bytesize
raise
'Outside of chunk size'
if
CHUNK_SIZE
<
offset
+
new_data
.
bytesize
self
.
set_data
(
current_data
.
byteslice
(
0
,
offset
)
+
new_data
)
self
.
set_data
(
current_data
.
byteslice
(
0
,
offset
)
+
new_data
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment