Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364406 - java.lang.ArrayIndexOutOfBoundsException during PDF rendition
Summary: java.lang.ArrayIndexOutOfBoundsException during PDF rendition
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.6.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.4.0   Edit
Assignee: Wei Yan CLA
QA Contact: Hao Zhou CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-21 13:52 EST by Donald Hayes CLA
Modified: 2014-08-12 13:17 EDT (History)
3 users (show)

See Also:


Attachments
array index fix when processing "padding" (17.17 KB, patch)
2013-03-05 15:40 EST, Donald Hayes CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.