Skip to main content

2015 | OriginalPaper | Buchkapitel

OpenJDK’s Java.utils.Collection.sort() Is Broken: The Good, the Bad and the Worst Case

verfasst von : Stijn de Gouw, Jurriaan Rot, Frank S. de Boer, Richard Bubel, Reiner Hähnle

Erschienen in: Computer Aided Verification

Verlag: Springer International Publishing

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

We investigate the correctness of TimSort, which is the main sorting algorithm provided by the Java standard library. The goal is functional verification with mechanical proofs. During our verification attempt we discovered a bug which causes the implementation to crash. We characterize the conditions under which the bug occurs, and from this we derive a bug-free version that does not compromise the performance. We formally specify the new version and mechanically verify the absence of this bug with KeY, a state-of-the-art verification tool for Java.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
2
TimSort can also be used to sort only a segment of the input array; in this case, len should be based on the length of this segment. In the current implementation this is not the case, which negatively affects performance.
 
3
These parameters shadow the instance variables with the same name; to refer to the instance variables in specifications one prefixes this, just like in Java.
 
7
As the Python version works with 64bit integer types and uses larger bounds for runLen, it is even more unlikely to occur, however.
 
Literatur
1.
Zurück zum Zitat Ahrendt, W., Mostowski, W., Paganelli, G.: Real-time Java API specifications for high coverage test generation. In: Proceedings of the 10th International Workshop on Java Technologies for Real-time and Embedded Systems, JTRES 2012, pp. 145–154. ACM, New York (2012) Ahrendt, W., Mostowski, W., Paganelli, G.: Real-time Java API specifications for high coverage test generation. In: Proceedings of the 10th International Workshop on Java Technologies for Real-time and Embedded Systems, JTRES 2012, pp. 145–154. ACM, New York (2012)
2.
Zurück zum Zitat Akbarpour, B., Abdel-Hamid, A.T., Tahar, S., Harrison, J.: Verifying a synthesized implementation of IEEE-754 floating-point exponential function using HOL. Comput. J. 53(4), 465–488 (2010)CrossRef Akbarpour, B., Abdel-Hamid, A.T., Tahar, S., Harrison, J.: Verifying a synthesized implementation of IEEE-754 floating-point exponential function using HOL. Comput. J. 53(4), 465–488 (2010)CrossRef
3.
Zurück zum Zitat Beckert, B., Hähnle, R.: Reasoning and verification. IEEE Intell. Syst. 29(1), 20–29 (2014)CrossRef Beckert, B., Hähnle, R.: Reasoning and verification. IEEE Intell. Syst. 29(1), 20–29 (2014)CrossRef
4.
Zurück zum Zitat Beckert, B., Hähnle, R., Schmitt, P.H. (eds.): Verification of Object-Oriented Software: The KeY Approach. LNCS, vol. 4334. Springer, Heidelberg (2007) Beckert, B., Hähnle, R., Schmitt, P.H. (eds.): Verification of Object-Oriented Software: The KeY Approach. LNCS, vol. 4334. Springer, Heidelberg (2007)
5.
Zurück zum Zitat Pelevina, M., Bubel, R., Hähnle, R.: Fully abstract operation contracts. In: Margaria, T., Steffen, B. (eds.) ISoLA 2014, Part II. LNCS, vol. 8803, pp. 120–134. Springer, Heidelberg (2014) Pelevina, M., Bubel, R., Hähnle, R.: Fully abstract operation contracts. In: Margaria, T., Steffen, B. (eds.) ISoLA 2014, Part II. LNCS, vol. 8803, pp. 120–134. Springer, Heidelberg (2014)
6.
Zurück zum Zitat de Gouw, S., de Boer, F.S., Rot, J.: Proof pearl: the key to correct and stable sorting. J. Autom. Reasoning 53(2), 129–139 (2014)CrossRef de Gouw, S., de Boer, F.S., Rot, J.: Proof pearl: the key to correct and stable sorting. J. Autom. Reasoning 53(2), 129–139 (2014)CrossRef
8.
Zurück zum Zitat Filliâtre, J.-C., Magaud, N.: Certification of sorting algorithms in the system Coq. In: Theorem Proving in Higher Order Logics: Emerging Trends. Nice (1999) Filliâtre, J.-C., Magaud, N.: Certification of sorting algorithms in the system Coq. In: Theorem Proving in Higher Order Logics: Emerging Trends. Nice (1999)
9.
10.
Zurück zum Zitat Hähnle, R., Schaefer, I., Bubel, R.: Reuse in software verification by abstract method calls. In: Bonacina, M.P. (ed.) CADE 2013. LNCS, vol. 7898, pp. 300–314. Springer, Heidelberg (2013) CrossRef Hähnle, R., Schaefer, I., Bubel, R.: Reuse in software verification by abstract method calls. In: Bonacina, M.P. (ed.) CADE 2013. LNCS, vol. 7898, pp. 300–314. Springer, Heidelberg (2013) CrossRef
11.
Zurück zum Zitat Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D., Müller, P., Kiniry, J., Chalin, P., Zimmerman, D.M., Dietl, W.:. JML Reference Manual, Draft revision 2344 (2013) Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D., Müller, P., Kiniry, J., Chalin, P., Zimmerman, D.M., Dietl, W.:. JML Reference Manual, Draft revision 2344 (2013)
12.
Zurück zum Zitat McIlroy, P.M.: Optimistic sorting and information theoretic complexity. In: Ramachandran, V. (ed.) Proceedings of the Fourth Annual ACM/SIGACT-SIAM Symposium on Discrete Algorithms, pp. 467–474. ACM/SIAM, Austin (1993) McIlroy, P.M.: Optimistic sorting and information theoretic complexity. In: Ramachandran, V. (ed.) Proceedings of the Fourth Annual ACM/SIGACT-SIAM Symposium on Discrete Algorithms, pp. 467–474. ACM/SIAM, Austin (1993)
13.
Zurück zum Zitat Mostowski, W.: Formalisation and verification of Java Card security properties in dynamic logic. In: Cerioli, M. (ed.) FASE 2005. LNCS, vol. 3442, pp. 357–371. Springer, Heidelberg (2005) CrossRef Mostowski, W.: Formalisation and verification of Java Card security properties in dynamic logic. In: Cerioli, M. (ed.) FASE 2005. LNCS, vol. 3442, pp. 357–371. Springer, Heidelberg (2005) CrossRef
14.
Zurück zum Zitat Mostowski, W.: Fully verified Java card API reference implementation. In: Beckert, B. (ed.) Proceedings of the 4th International Verification Workshop in Connection with CADE-21, CEUR Workshop Proceedings, Vol. 259, CEUR-WS.org, Bremen (2007) Mostowski, W.: Fully verified Java card API reference implementation. In: Beckert, B. (ed.) Proceedings of the 4th International Verification Workshop in Connection with CADE-21, CEUR Workshop Proceedings, Vol. 259, CEUR-WS.org, Bremen (2007)
16.
Zurück zum Zitat Sternagel, C.: Proof pearl - a mechanized proof of ghc’s mergesort. J. Autom. Reasoning 51(4), 357–370 (2013)MathSciNetCrossRef Sternagel, C.: Proof pearl - a mechanized proof of ghc’s mergesort. J. Autom. Reasoning 51(4), 357–370 (2013)MathSciNetCrossRef
Metadaten
Titel
OpenJDK’s Java.utils.Collection.sort() Is Broken: The Good, the Bad and the Worst Case
verfasst von
Stijn de Gouw
Jurriaan Rot
Frank S. de Boer
Richard Bubel
Reiner Hähnle
Copyright-Jahr
2015
DOI
https://doi.org/10.1007/978-3-319-21690-4_16