Exemplo n.º 1
0
        public static ThresholdInputStream AddThreshold(Stream zipIS)
        {
            ThresholdInputStream newInner = null;

            if (zipIS is InflaterInputStream)
            {
                //replace inner stream of zipIS by using a ThresholdInputStream instance??
                try
                {
                    FieldInfo f = typeof(FilterInputStream).GetField("in");
                    //f.SetAccessible(true);
                    //InputStream oldInner = (InputStream)f.Get(zipIS);
                    //newInner = new ThresholdInputStream(oldInner, null);
                    //f.Set(zipIS, newInner);
                } catch (Exception ex) {
                    //logger.Log(POILogger.WARN, "SecurityManager doesn't allow manipulation via reflection for zipbomb detection - continue with original input stream", ex);
                    newInner = null;
                }
            }
            else
            {
                // the inner stream is a ZipFileInputStream, i.e. the data wasn't compressed
                newInner = null;
            }

            return(new ThresholdInputStream(zipIS, newInner));
        }
Exemplo n.º 2
0
            public ThresholdInputStream(Stream is1, ThresholdInputStream cis)

            {
                this.input = is1;
                this.cis   = cis;
            }