http://defect.opensolaris.org/bz/show_bug.cgi?id=19228

Lubos Kosco <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |CAUSEKNOWN
   Target Milestone|---                         |next

--- Comment #1 from Lubos Kosco <[email protected]> 2012-07-11 09:00:11 
UTC ---
--- a/src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java   Thu Jul 05
13:13:30 2012 +0200
+++ b/src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java   Wed Jul 11
10:59:09 2012 +0200
@@ -450,17 +449,21 @@
      * @param in The stream containing the data to analyze
      * @return the analyzer factory to use
      * @throws java.io.IOException if an error occurs while reading data from
-     *                             the stream
+     * the stream
      */
     public static FileAnalyzerFactory find(InputStream in) throws IOException
{
         in.mark(8);
-        byte[] content = new byte[8];
+        byte[] content = new byte[8];
         int len = in.read(content);
         in.reset();
-
-        /* Need at least 4 bytes to perform magic string matching. */
-        if (len < 4) {
-            return null;
+        if (len < 8) {
+            /*
+             * Need at least 4 bytes to perform magic string matching.
+             */
+            if (len < 4) {
+                return null;
+            }
+            content = Arrays.copyOf(content, len);
         }

-- 
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
opengrok-dev mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opengrok-dev

Reply via email to