Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libjava / classpath / javax / sound / midi / MetaMessage.java
index 4d43975..0aab153 100644 (file)
@@ -120,10 +120,12 @@ public class MetaMessage extends MidiMessage
 
     // Now compute the length representation
     long buffer = length & 0x7F;
-    while ((length >>= 7) > 0)
+    // Avoid altering length variable; PR42551
+    lengthValue = length;
+    while ((lengthValue >>= 7) > 0)
     {
       buffer <<= 8;
-      buffer |= ((length & 0x7F) | 0x80);
+      buffer |= ((lengthValue & 0x7F) | 0x80);
     }
 
     // Now store the variable length length value