[java-identity-provider] branch master updated: IDP-1190 idp-gui: Guard against malformed mdui input

Rod Widdowson rdw at steadingsoftware.com
Wed Apr 18 11:58:41 EDT 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=7a0ad406d428ee912242d5f5f727d89129ab2727

The following commit(s) were added to refs/heads/master by this push:
       new  7a0ad40   IDP-1190 idp-gui:  Guard against malformed mdui input
7a0ad40 is described below

commit 7a0ad406d428ee912242d5f5f727d89129ab2727
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Apr 18 16:57:20 2018 +0100

    IDP-1190 idp-gui:  Guard against malformed mdui input
    
    https://issues.shibboleth.net/jira/browse/IDP-1190
    
    If no width or height is specified then we should not NPE.
    Rather we just decide that the logo fits (and issue a WARN).
---
 .../idp/ui/context/RelyingPartyUIContext.java      | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
index 0e2f536..6d680fd 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
@@ -26,12 +26,6 @@ import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-
 import org.opensaml.messaging.context.BaseContext;
 import org.opensaml.saml.ext.saml2mdui.Description;
 import org.opensaml.saml.ext.saml2mdui.DisplayName;
@@ -55,6 +49,12 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableList;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
 /**
  * The context which carries the user interface information.
  */
@@ -707,8 +707,21 @@ public class RelyingPartyUIContext extends BaseContext {
      */
     private boolean logoFits(final Logo logo, final int minWidth, final int minHeight, final int maxWidth,
             final int maxHeight) {
-        return logo.getHeight() <= maxHeight && logo.getHeight() >= minHeight && logo.getWidth() <= maxWidth
-                && logo.getWidth() >= minWidth;
+        final int height;
+        if (null == logo.getHeight()) {
+            log.warn("No height available for {} assuming a fit", logo.getURL());
+            height = maxHeight -1;
+        } else {
+            height = logo.getHeight();
+        }
+        final int width;
+        if (null == logo.getWidth()) {
+            log.warn("No width available for {} assuming a fit", logo.getURL());
+            width = maxWidth - 1;
+        } else {
+            width = logo.getWidth();
+        }
+        return height <= maxHeight && height >= minHeight && width <= maxWidth && width >= minWidth;
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list