< prev index next >

src/jdk.jdwp.agent/share/native/libjdwp/SDE.c

Print this page
rev 16214 : 8170663: Fix minor issues in corelib and servicabilty coding.
Contributed-by: David CARLIER <devnexen@gmail.com>, goetz.lindenmaier@sap.com
Reviewed-by: dsamersoff

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -247,20 +247,23 @@
         jvmtiLineNumberEntry *toEntry = *tablePtr;
         int cnt = *entryCountPtr;
         int lastLn = 0;
         int sti;
 
+        if (cnt < 0) {
+            return;
+        }
         loadDebugInfo(env, clazz);
         if (!isValid()) {
             return; /* no SDE or not SourceMap - return unchanged */
         }
         sti = stratumTableIndex(globalDefaultStratumId);
-        if (sti == baseStratumIndex) {
+        if (sti == baseStratumIndex || sti < 0) {
             return; /* Java stratum - return unchanged */
         }
         LOG_MISC(("SDE is re-ordering the line table"));
-        for (; cnt-->0; ++fromEntry) {
+        for (; cnt-- > 0; ++fromEntry) {
             int jplsLine = fromEntry->line_number;
             int lti = stiLineTableIndex(sti, jplsLine);
             if (lti >= 0) {
                 int fileId = lineTable[lti].fileId;
                 int ln = stiLineNumber(sti, lti, jplsLine);
< prev index next >