Issue #6365 has been updated by Michael Stahnke.

Description updated
Status changed from Unreviewed to Accepted
Assignee set to Gary Larizza

Gary, I think this has been what you've kind of been working on in your spare 
time.  Assigning to you. 
----------------------------------------
Bug #6365: Plist parser can segfault
https://projects.puppetlabs.com/issues/6365

Author: Markus Roberts
Status: Accepted
Priority: High
Assignee: Gary Larizza
Category: library
Target version: 1.6.x
Keywords: 
Branch: 
Affected Facter version: 


The vendored plist parser can (and will) segfault when fed valid OSX plists 
because it attempts to interpret the contents of data tags using Marshal.  In 
no case does the Marshal process presently produce valid results; we 
always/only care about the result produced by the rescue clause in the cases 
where it doesn't segfault.

Simplifying the code to never call Marshal:

<pre>
diff --git a/lib/facter/util/plist/parser.rb b/lib/facter/util/plist/parser.rb
index 48e1034..61d0a3e 100644
--- a/lib/facter/util/plist/parser.rb
+++ b/lib/facter/util/plist/parser.rb
@@ -209,16 +209,7 @@ module Plist
     require 'base64'
     class PData < PTag
         def to_ruby
-            data = Base64.decode64(text.gsub(/\s+/, ''))
-
-            begin
-                return Marshal.load(data)
-            rescue Exception => e
-                io = StringIO.new
-                io.write data
-                io.rewind
-                return io
-            end
+            StringIO.new(Base64.decode64(text.gsub(/\s+/, '')))
         end
     end
 end
</pre>

...gives us the same results but without the segfaults.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to