Patches: Browse | Submit New | Admin

[#27639] Fix for iconv conversion error

Date:
2009-12-30 16:41
Priority:
3
Submitted By:
Brian Goetz (briangoetz)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Fix for iconv conversion error

Detailed description
Here's a patch that fixes the error I just reported, where wmainfo barfs on construction if it cannot successfully convert
all the fields using iconv:

-- /usr/lib/ruby/gems/1.8/gems/wmainfo-rb-0.6/lib/wmainfo.rb   2009-12-29 00:50
:02.000000000 -0500
+++ wmainfo.rb  2009-12-29 23:56:19.000000000 -0500
@@ -235,7 +235,12 @@
       lengths[key] = read_and_increment_offset(2).unpack("v")[0]
     end
     keys.each do |key| # now pull the data based on length
-      @tags[key] = decode_binary_string(read_and_increment_offset(lengths[key])
)
+      begin
+          data = read_and_increment_offset(lengths[key])
+          @tags[key] = decode_binary_string(data)
+      rescue
+          @tags[key] = "Unavailable (iconv decode error)"
+      end
     end
   end

@@ -252,7 +257,11 @@

       value = read_and_increment_offset(ext['value_length'])
       if ext['value_type'] <= 1
+        begin
         ext['value'] = decode_binary_string(value)
+        rescue
+            ext['value'] = "Unavailable (iconv decode error)"
+        end
       elsif ext['value_type'] == 4
         ext['value'] = parse_64bit_string(value)
       else

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item