Skip to content

Commit

Permalink
corrupt data parser
Browse files Browse the repository at this point in the history
  • Loading branch information
mkokryashkin committed Dec 3, 2023
1 parent af546db commit e59c4b5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions tools/memprof/parse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,15 @@ function M.parse(reader, symbols)
))
end

while parse_event(reader, events, symbols) do
-- Empty body.
local ok, has_more = pcall(parse_event, reader, events, symbols)
while ok and has_more do
ok, has_more = pcall(parse_event, reader, events, symbols)
end

if not ok and has_more then
io.stderr:write(
'WARNING: Corrupt profile data: only a part of the events is available.'
)
end

return events
Expand Down
12 changes: 10 additions & 2 deletions tools/sysprof/parse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,16 @@ function M.parse(reader, symbols)
))
end

while parse_event(reader, events, symbols) do
-- Empty body.

local ok, has_more = pcall(parse_event, reader, events, symbols)
while ok and has_more do
ok, has_more = pcall(parse_event, reader, events, symbols)
end

if not ok and has_more then
io.stderr:write(
'WARNING: Corrupt profile data: only a part of the events is available.'
)
end

return events
Expand Down

0 comments on commit e59c4b5

Please sign in to comment.