skip to main content
10.1145/2950290.2983976acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
abstract

Enforcing correct array indexes with a type system

Published:01 November 2016Publication History

ABSTRACT

We have built the Index Checker, a type checker that issues warnings about array, list, and string accesses that are potentially unsafe. An example is shown in Figure 1. As with any sound tool, some of its warnings may be false positives. If the Index Checker issues no warning, then the programmer is guaranteed that no array access will cause an IndexOutOfBoundsException at run time (modulo suppressed warnings and unchecked code). The Index Checker ships with knowledge of Java APIs. The developer can optionally write a few type annotations in the program to make the Index Checker more precise. Our system includes five new type qualifiers, defined in Figure 2, that can be applied to integral types such as Java int. These are dependent types that indicate the relationship between the int and given arrays. Figures 3 and 4 show the relationship among these type qualifiers. The type system also contains a type qualifier for arrays, @MinLen, which is a lower bound on its length and permits use of literal integers to access the array or to construct a new array. The Index Checker is built upon the Checker Framework (http://CheckerFramework.org/).

References

  1. D. L. Detlefs, K. R. M. Leino, G. Nelson, and J. B. Saxe. Extended static checking. SRC Research Report 159, Compaq Systems Research Center, December 18, 1998.Google ScholarGoogle Scholar
  2. W. Dietl, S. Dietzel, M. D. Ernst, K. Mu¸slu, and T. Schiller. Building and using pluggable type-checkers. In ICSE’11, Proceedings of the 33rd International Conference on Software Engineering, pages 681–690, Waikiki, Hawaii, USA, May 25–27, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. D. Ernst. Static and dynamic analysis: Synergy and duality. In WODA 2003: Workshop on Dynamic Analysis, pages 24–27, Portland, Oregon, May 9, 2003.Google ScholarGoogle Scholar
  4. D. Evans. Static detection of dynamic memory errors. In PLDI 1996, Proceedings of the SIGPLAN ’96 Conference on Programming Language Design and Implementation, pages 44–53, Philadelphia, PA, USA, May 21–24, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. B. Hackett, M. Das, D. Wang, and Z. Yang. Modular checking for buffer overflows in the large. In ICSE’06, Proceedings of the 28th International Conference on Software Engineering, pages 232–241, Shanghai, China, May 24–26, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Hastings and B. Joyce. Purify: A tool for detecting memory leaks and access errors in C and C++ programs. In Proceedings of the Winter 1992 USENIX Conference, pages 125–138, San Francisco, CA, USA, January 20–24, 1992.Google ScholarGoogle Scholar
  7. D. Hovemeyer and W. Pugh. Finding bugs is easy. In Companion to Object-Oriented Programming Systems, Languages, and Applications (OOPSLA 2004), pages 132–136, Vancouver, BC, Canada, October 26–28, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. R. M. Leino and G. Nelson. An extended static checker for Modula-3. In Compiler Construction: 7th International Conference, CC’98, pages 302–305, Lisbon, Portugal, April 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. N. Nethercote and J. Seward. Valgrind: A framework for heavyweight dynamic binary insrumentation. In PLDI 2007, Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation, pages 89–100, San Diego, CA, USA, June 11–13, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. M. Papi, M. Ali, T. L. Correa Jr., J. H. Perkins, and M. D. Ernst. Practical pluggable types for Java. In ISSTA 2008, Proceedings of the 2008 International Symposium on Software Testing and Analysis, pages 201–212, Seattle, WA, USA, July 22–24, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. N. Suzuki and K. Ishihata. Implementation of an array bound checker. In POPL ’77, Proceedings of the Fourth Annual ACM Symposium on Principles of Programming Languages, pages 132–143, Los Angeles, CA, January 17–19, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In PLDI 1998, Proceedings of the ACM SIGPLAN’98 Conference on Programming Language Design and Implementation, pages 249–257, Montreal, Canada, June 17–19 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Enforcing correct array indexes with a type system

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      FSE 2016: Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering
      November 2016
      1156 pages
      ISBN:9781450342186
      DOI:10.1145/2950290

      Copyright © 2016 Owner/Author

      Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 November 2016

      Check for updates

      Qualifiers

      • abstract

      Acceptance Rates

      Overall Acceptance Rate17of128submissions,13%

      Upcoming Conference

      FSE '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader