[PATCH] D70183: Detect source location overflow due includes

Mikhail Maltsev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 09:38:51 PST 2019


miyuki added a comment.

In D70183#1751813 <https://reviews.llvm.org/D70183#1751813>, @dnsampaio wrote:

> Git diff 979ae80af7ec49624b932954d22cb91900f17121 did not send a test as well. Feel free to send me a reasonable sized reproducer, the one I have is about 36MB. Don't think it will be that well received.




  #!/usr/bin/env python3
  
  def gen_100k():
      s = '/*' + (' '*95) + '*/\n'
      with open('inc100k.h', 'wt') as out_f:
          for _ in range(0, 1000):
              out_f.write(s)
  
  def gen_100M():
      s = '#include "inc100k.h"\n'
      with open('inc100M.h', 'wt') as out_f:
          for _ in range(0, 1000):
              out_f.write(s)
  
  def gen_main():
      s = '#include "inc100M.h"\n'
      with open('reproducer.c', 'wt') as out_f:
          for _ in range(0, 25):
              out_f.write(s)
  
  def main():
      gen_100k()
      gen_100M()
      gen_main()
  
  if __name__ == '__main__':
      main()


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70183/new/

https://reviews.llvm.org/D70183





More information about the cfe-commits mailing list