After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 427605 - Crash in gda_delimiter_parse with too long tokens
Crash in gda_delimiter_parse with too long tokens
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: general
2.99.x
Other Linux
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-08 15:39 UTC by Armin Burgmeier
Modified: 2007-04-14 15:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase (434 bytes, text/plain)
2007-04-08 15:41 UTC, Armin Burgmeier
  Details
proposed patch (4.01 KB, patch)
2007-04-13 13:11 UTC, malerba
none Details | Review
patch for libgda/sql-delimiter/lexer.l (4.50 KB, patch)
2007-04-13 14:32 UTC, malerba
none Details | Review

Description Armin Burgmeier 2007-04-08 15:39:18 UTC
gda_delimiter_parse() crashes when the SQL query fed to it contains tokens that are too long. The attached testcase has the problem with a string of length 2976 bytes, but not with 2975 bytes.
Comment 1 Armin Burgmeier 2007-04-08 15:41:30 UTC
Created attachment 86012 [details]
Testcase

This crashes when DO_CRASH is defined by feeding a string with 2976 characters to gda_delimiter_parse(). Otherwise, it does not crash and only gives 2975 characters to the function.
Comment 2 malerba 2007-04-13 13:11:29 UTC
Created attachment 86288 [details] [review]
proposed patch

The problem probably comes from the fact that the lexer limits token sizes to 2048 bytes but does not check the actual token sizes. The attached patch adds some tests. You should normally not have any crash anymore, but a reported error such as:
SQL Parser error: Token too long (limited to 2048 bytes) near `c'

If the patch is Ok, then I'll augment the limit to 3 or 4 kb, or add a dynamic limit.
Comment 3 malerba 2007-04-13 14:32:40 UTC
Created attachment 86294 [details] [review]
patch for libgda/sql-delimiter/lexer.l

This patch is better since it uses a GString and so imposes no limit on the size of strings or textual expressions. If it's Ok I'll apply it in SVN.
Comment 4 Armin Burgmeier 2007-04-14 15:10:41 UTC
Your patch works for me. Thanks.
Comment 5 malerba 2007-04-14 15:34:38 UTC
Ok, closing it then.