IACR / latex-submit

Web server to receive uploaded LaTeX and execute it in a docker container.
GNU Affero General Public License v3.0
11 stars 0 forks source link

Fix crashes from HtmlDiff in final review #67

Open kmccurley opened 2 months ago

kmccurley commented 2 months ago

I found an example where calculating HtmlDiff in admin.py::final_review() went into an infinite loop and eventually caused the apache process to time out. In the case that caused the error, it was trying to compare crypto.bib from cryptobib with another small file of the same name, and it ran out of RAM. There is apparently a known problem in HtmlDiff. The solution is not obvious, but I can think of several approaches:

  1. give up on calculating diffs. This would be unfortunate.
  2. only calculate diffs when the files are both small. This has the unfortunate requirement to stat() every file, but would be safer.
  3. only calculate diffs when the files are "relatively close in size". I'm not sure what that would be.
  4. use a second process to timeout the calculation of HtmlDiff. See https://medium.com/@chaoren/how-to-timeout-in-python-726002bf2291 for a way to do this. This seems clumsy but would probably be safe.