Skip to content

Commit

Permalink
Do not crash when trying to parse "nil" XML file (bsc#1176593)
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Sep 24, 2020
1 parent f013a5f commit 7bec740
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions library/control/src/modules/WorkflowManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,8 @@ def WorkflowRequiresRegistration(src_id)
end

def IncorporateControlFileOptions(filename)
return false if filename.nil?

begin
update_file = XML.XMLToYCPFile(filename)
rescue RuntimeError => e
Expand Down
2 changes: 1 addition & 1 deletion library/xml/src/modules/XML.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def YCPToXMLString(doc_type, contents)
# @return [Hash] parsed content
# @raise [XMLDeserializationError] when non supported XML is passed
def XMLToYCPFile(xml_file)
raise XMLDeserializationError, "Cannot find XML file" if SCR.Read(path(".target.size"), xml_file) <= 0
raise XMLDeserializationError, "Cannot find XML file" if xml_file.nil? || SCR.Read(path(".target.size"), xml_file) <= 0

log.info "Reading #{xml_file}"
XMLToYCPString(SCR.Read(path(".target.string"), xml_file))
Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Sep 24 07:25:01 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

- Do not crash when trying to parse non-existing ("nil") add-on
product control XML file (bsc#1176593)
- 4.3.30

-------------------------------------------------------------------
Wed Sep 23 13:21:38 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 4.3.29
Version: 4.3.30
Release: 0
Summary: YaST2 Main Package
License: GPL-2.0-only
Expand Down

0 comments on commit 7bec740

Please sign in to comment.