Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364406

Summary: java.lang.ArrayIndexOutOfBoundsException during PDF rendition
Product: z_Archived Reporter: Donald Hayes <dbh03079>
Component: BIRTAssignee: Wei Yan <wyan>
Status: RESOLVED FIXED QA Contact: Hao Zhou <hao.zhou>
Severity: normal    
Priority: P3 CC: bluesoldier, hustlg, zqian
Version: 2.6.0   
Target Milestone: 4.4.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
array index fix when processing "padding" none

Description Donald Hayes CLA 2011-11-21 13:52:13 EST
Build Identifier: 

A java.lang.ArrayIndexOutOfBoundsException is generated when a dynamic text box has HTML content and an element has a style containing padding or margin with 4 entries.  For example: an HTML style containing "margin: 0in -5.4pt 0pt 0in" will cause an exception.

The bug is in ShortHandProcessor.java (plugins/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/pdf/util).  In the static ShortHandProcessor for both margin and padding, there is a switch statement on the length of an array ("vs").  Case 4 tries to dereference the array as "vs[4]" which is guaranteed to be out of bounds.  It should be "vs[3]" in both places.

Reproducible: Always
Comment 1 Gang Liu CLA 2011-12-12 00:15:59 EST
fixed
Comment 2 Hao Zhou CLA 2012-01-10 04:03:54 EST
Verified in 3_7_2-20111216.
Comment 3 Donald Hayes CLA 2012-10-11 12:58:54 EDT
This bug still exists in BIRT 4.2.0 for an HTML style containing "padding".  It was only fixed for style containing "margin".

The array dereference on lines 123-124 in ShortHandProcessor.java should be corrected as well (should be "vs[3]" instead of "vs[4]").
Comment 4 Donald Hayes CLA 2013-03-05 15:40:53 EST
Created attachment 227961 [details]
array index fix when processing "padding"

The attached file fixes the erroneous array dereference when processing an HTML "padding" style element.
Comment 5 Zhiqiang Qian CLA 2014-07-28 17:47:05 EDT
Mark as fixed. See commit 5eeefcf02e449199e5ae9b4309c03714ced6eeea.