Skip to content

core dump with nlohmann::detail::type_error on bad JSON #8

@pdurbin

Description

@pdurbin

I'm running c53dea4 and I'm getting a core dump when I POST a JSON string to the /provapi/json Python endpoint that it doesn't expect:

client

murphy:~ pdurbin$ cat /tmp/bad.json
{
  "bundle_name": "224-uploadJson",
  "JSON": {
    "entity": {
      "event": {
        "prov:type": "fileUploaded"
      }
    },
    "prefix": {
      "event": {
        "prov": "https://www.w3.org/ns/prov#",
        "rdt": "http://rdatatracker.org/"
      }
    },
    "activity": {
      "p1": {
        "rdt:name": "foo.png",
        "rdt:type": "dataset-42-publish"
      }
    }
  }
}
murphy:~ pdurbin$ curl -i -X POST -H 'Content-type: application/json' http://localhost:7777/provapi/json --upload-file /tmp/bad.json
HTTP/1.1 100 Continue

curl: (52) Empty reply from server
murphy:~ pdurbin$

server

root@ubuntu-xenial:/prov-cpl/bindings/python/RestAPI# su $REST_SERVICE_USER -s /bin/sh -c "python cpl-rest.py --host=0.0.0.0"
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
terminate called after throwing an instance of 'nlohmann::detail::type_error'
  what():  [json.exception.type_error.302] type must be string, but is object
Aborted (core dumped)
root@ubuntu-xenial:/prov-cpl/bindings/python/RestAPI# 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions