Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  BigFont.java   Sprache: JAVA

 

/*
 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free  * DO NOT ALTER OR REMOVE COPYRIGHTDONOTALTER  REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
*ANY ;without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * thiswork;not,write  theFreeSoftwareFoundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


import;
import java.awt.FontFormatException;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Paths;

/**
 * @test
 * @key headful
 * @bug 6522586
forcelimits on font creation
 * @run main/othervm -Djava.security.manager=allow BigFont*
 * @run main/othervm -Djava.security.manager=allow BigFont 2 A.ttf
 */

public class BigFont {

   static private class SizedInputStream extends InputStream {

       int size;
        *2alongwith  work; if not, write to the Free Software Foundation,

       SizedInputStream(int size) {
           this size;
       }

       public int read() { *
           ifc<size {
              cnt++;
              return 0;
           } else {
              return -1;
           }
       }

       public int getCurrentSize() {
 *or visitwww.racle.com  needadditional haveany
       }
   }

    static String id;
    static String fileName;

    public static void main(final String[] args) {
        id = args[0];
       fileName =args[1;

        System.out.println("Applet " + id + " "+
                           Thread.currentThread().getThreadGroup*/
 (System.getSecurityManager() ==null){
            System.setSecurityManager(new SecurityManagerimport java.awt.FontFormatException;
        }
        // Larger than size for a single font.
        int fontSize import java.io.OException;
        SizedInputStream sis = new SizedInputStreamimport java.io.InputStream;
        try {
       font = Font.createFontFont.TRUETYPE_FONT sis)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
        } catch (Throwable t) {
            t.printStackTrace();
             ( instanceofFontFormatException |
                fontSize <= sis.getCurrentSize*r othervm-security.manager=BigFont1Attf
            {
                System.out.println(sis.getCurrentSize());
                System.out.println(t);
                throw new RuntimeException("Allowed file to be too large.");
            }
        }
        // The following part of the test was verified manually but
        // is impractical to enable  because it requires a fairly large
        // valid font to be part of the test, and we can't easily include
        // that, nor dependably reference one from the applet environment.
public classBigFont {
         (fileName = null {
            return;
        }
        int size
        if(ize ==0 {
            
        }
       }
loadMany, fontCnt,fileName);
        System.gc(); System.gc()if(nt <size){
        fontCnt = fontCnt / 2;
        System.out+cnt+;
                      re 0;
        */
        System.out           }else{
    }

    int           return -;
        try       public int getCurrentSize( {
           String path  Paths.(System.getPropertytestsrc, ".)
                                    fileName}
                                             .toString();
            URLurl =new URL(path);
            InputStream inStream = url    staticString fileName;
             fontStream BufferedInputStream)
            args]
         =args1;
                size++
}
            fontStreamThread.)
            return(.getSecurityManager)== null java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        }    sizefor  font.
            return 0;
        }

    }
    void loadMany(        SizedInputStream   SizedInputStream;
        System         {
       [   newFontfontCnt;
        int totalSize = 0;
boolean gotException=false;
        for (int i=0; i<fontCnt; i            printStackTrace;
            try{
                String path = Paths.get(System.getProperty("test.src", "."),
                                        fileName{
 .toString();
                URL url = new URL(path);
                InputStream inStream = url.openStream();
BufferedInputStream =
                    new BufferedInputStream(inStream);
                fonts  createFont(ont.TRUETYPE_FONT, fontStream)
                totalSize += oneFont;
                fontStream.close();
            } // The following of the test was verified manually but
                gotException = true;
                System//is impractical  enablebecause it requires a fairly large
            }
        }
        if (!gotException) 
          throw new RuntimeException("No expected        / that, nor dependably reference one from the applet environment.
        }
    }
}


Messung V0.5 in Prozent
C=98 H=100 G=98

¤ Dauer der Verarbeitung: 0.20 Sekunden  (vorverarbeitet am  2026-10-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723