From 2ec24a6433b77cf421e602450dafff2b371b8afc Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 26 Aug 2014 16:05:20 +0200 Subject: Improved Positioning input validation for signature rotation --- .../main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pdf-as-lib') diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java index 420a8f0a..e49b481e 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java @@ -253,11 +253,12 @@ public class TablePos implements Serializable } case 'r': { float flval=Float.parseFloat(commandval); - // TODO: check rotation to be only multiples of 90 degrees - if (flval<0) - { - throw new PdfAsException("Pos string (=" + pos_string + ") is invalid."); - } + // reduce to 0 - 360 degrees + flval = flval % 360; + // we only support rotation in 90 degree steps + if(flval % 90 != 0) { + throw new PdfAsException("Pos string (=" + pos_string + ") is invalid. Rotation is only allowed to be a multiple of 90."); + } this.rotation = flval; break; } -- cgit v1.2.3