zotero / citeproc-rs

CSL processor in Rust.

Home Page:https://cormacrelf.github.io/citeproc-wasm-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index out of bounds when inserting reference with the WASM driver

adomasven opened this issue · comments

This is the input to insertReference():

{
  "id": "1303",
  "type": "chapter",
  "abstract": "Another dimension of the institutional neutrality debate revolves around admissions. Who shall be allowed to go to college? What kind of college? How are the applicant’s credentials to be judged? Shall such extraneous variables as race be given any consideration? Is it proper for universities to set quotas to accommodate minorities, or go even further to a policy of “open admissions”?\nAgain, the debate basically turns on the conception of the university, and the role it plays in society. To the “classicist,” the university has three primary obligations: first, a commitment to transmit high culture—to shape students’ mind and",
  "container-title": "The Test",
  "ISBN": "978-0-87013-648-1",
  "page": "183-202",
  "publisher": "Michigan State University Press",
  "source": "JSTOR",
  "title": "THE GUARDIANS OF EXCELLENCE",
  "URL": "http://www.jstor.org/stable/10.14321/j.ctt130hjnp.11",
  "editor": [
    {
      "family": "ADAMS",
      "given": "WALTER"
    }
  ],
  "accessed": {
    "date-parts": [
      [
        "2017",
        10,
        20
      ]
    ]
  },
  "issued": {
    "date-parts": [
      [
        "2003"
      ]
    ]
  }
}

Stack trace:

RuntimeError: index out of bounds
    driver_insertReference@resource://zotero/loader.jsm -> resource://zotero/citeproc-rs.js:2746873:1
    insertReference@resource://zotero/loader.jsm -> resource://zotero/citeproc-rs.js:191:9

I don't know what's up with the stack trace. citeproc-rs.js:2746873 does not exist, citeproc-rs.js has 499 lines.

The huge line number means “it’s webassembly with no debug information to decode these weird stack frames, so we’re just going to give you an offset into the binary and use the file name that loaded this program”. Let me have a look with debug info and the console feature enabled.

So, I can't reproduce this in the demo. Any details you can add?

This was broken in 898047f, but I cannot reproduce it with the current master, so probably a problem on that specific branch in some intermediate state.