Giter VIP home page Giter VIP logo

Comments (5)

michaelkuhn avatar michaelkuhn commented on June 15, 2024

@Qualenritter Could you please take a look?

from julea.

Qualenritter avatar Qualenritter commented on June 15, 2024

I found a few issues when writing tests for the db client:

  1. j_db_schema_new does not properly check the namespace and name given. For instance, if they contain a -, errors will occur later on (see https://github.com/wr-hamburg/julea/blob/master/test/db/db.c#L68). This probably also applies to other parts of the db client.

Ok, I could write a regex, to whitelist the allowed namespaces and names.
For example ([a-zA-Z][a-zA-Z0-9_]*) should remove all errors of this kind.
Maybe this could be defined globally, since other backends for example "j_distributed_object_new" have the same issue too.

  1. Within the db client, errors seem to be overwritten somewhere (caused by 1.):
GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: sql prepare failed error was <DROP TABLE IF EXISTS test-ns_test_schema_0> 'near "-": syntax error'

This should not happen, I'll try to reproduce/fix this.

  1. Reference counting seems to be broken. If schemas are created in a loop with g_autoptr but the batch is executed outside of the loop, the address sanitizer complains about heap-use-after-free (see https://github.com/wr-hamburg/julea/blob/master/test/db/db.c#L110).

Objects, which are added to the network component are currently not reference counted.
The reason is, that every object is splitted into its variables, and there is no reference counting for "char*" or bson_t or GError.
I'll try to find a "simple" solution for this.

  1. https://travis-ci.org/wr-hamburg/julea/jobs/600321116

from julea.

michaelkuhn avatar michaelkuhn commented on June 15, 2024

Ok, I could write a regex, to whitelist the allowed namespaces and names.
For example ([a-zA-Z][a-zA-Z0-9_]*) should remove all errors of this kind.
Maybe this could be defined globally, since other backends for example "j_distributed_object_new" have the same issue too.

Apparently, SQLite supports these characters but they have to be quoted/bracketed: https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite

This should not happen, I'll try to reproduce/fix this.

Thanks!

Objects, which are added to the network component are currently not reference counted.
The reason is, that every object is splitted into its variables, and there is no reference counting for "char*" or bson_t or GError.
I'll try to find a "simple" solution for this.

It might be easiest to just reference the objects in their corresponding JBackendOperation (which will probably also need an unref_func member to not complicate the free function).

from julea.

Qualenritter avatar Qualenritter commented on June 15, 2024

Ok, I could write a regex, to whitelist the allowed namespaces and names.
For example ([a-zA-Z][a-zA-Z0-9_]*) should remove all errors of this kind.
Maybe this could be defined globally, since other backends for example "j_distributed_object_new" have the same issue too.

Apparently, SQLite supports these characters but they have to be quoted/bracketed: https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite

To prevent any kind of sql-injection, a whitelist to only letters and numbers is safe.
Is there a specific reason to allow '-' ?
Otherwise a '_' could be used in the middle of the name to have the same effect.
The interface was designed to allow any backend - not only SQLite - therefore we may not allow every possible special character because this may produce errors later.

This should not happen, I'll try to reproduce/fix this.

Thanks!

Objects, which are added to the network component are currently not reference counted.
The reason is, that every object is splitted into its variables, and there is no reference counting for "char*" or bson_t or GError.
I'll try to find a "simple" solution for this.

It might be easiest to just reference the objects in their corresponding JBackendOperation (which will probably also need an unref_func member to not complicate the free function).

I had a similar idea, but implementation will show if it works.

I think these aspects need to be considered:

  1. The object itself must be linked within the JBackendOperation
  2. ref count issues occur only on the client side - there is no object on the server -> no new code for the server.
  3. The (un)ref_func needs to be linked
  4. GError is supplied by the user. GError is NOT related to any specific Julea-DB-Object. If the user supplies the GError, the user must make sure, that GError is valid as long as it might be used - in this case the livetime of JBatch. If GError is freed within the loop, this is a programming error in the user code, not an error of Julia-DB. If the user don't want to check GError, the user must supply a NULL-ptr instead. Otherwise GError must be integrated into (and be owned by) JBatch.

from julea.

michaelkuhn avatar michaelkuhn commented on June 15, 2024

The stack overflow is still happening: https://travis-ci.org/wr-hamburg/julea/jobs/614492687

Any progress on this?

from julea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.