[asterisk-bugs] [JIRA] (ASTERISK-23582) Inconsistent column length in *odbc

Walter Doekes (JIRA) noreply at issues.asterisk.org
Thu Apr 3 06:21:18 CDT 2014


Walter Doekes created ASTERISK-23582:
----------------------------------------

             Summary: Inconsistent column length in *odbc
                 Key: ASTERISK-23582
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23582
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Functions/func_odbc, Resources/res_config_odbc
    Affects Versions: 1.8.26.1, SVN
            Reporter: Walter Doekes
            Severity: Minor


ODBC uses arbitrary 3 maximum column lengths:
 * static realtime var_val holds at most 1023 bytes
 * dynamic realtime columns hold at most 2047 bytes
 * func_odbc queries can also be at most 2047 bytes

Config reading from plain files (non-static realtime) does not have this 1023 byte limit.

And the other res_config_* do not seem affected by similar arbitrary limits.

Possible fixes:
 * Add a global setting that holds a single global value to keep them in sync
 * Fix the separate static allocations to be dynamic.

The first fix is attached.

The second fix is relatively easy for {{var_val}} and func_odbc. We could begin the static-realtime-conf reading with a {{SELECT MAX(LENGTH(var_val))}} or we could simply check for failed allocations and enlarge the heap-allocated buffer. That should happen very infrequently anyway. For the dynamic realtime a thread-local buffer would probably be preferred since we don't want to reallocate often there.

Thoughts?

P.S. The attached patch works for static-realtime-loaded func_odbc conf, loading a large select query. For example:
{noformat}
readsql=SELECT 000 UNION SELECT 001 UNION SELECT 002 UNION SELECT 003 UNION SELECT 004 UNION SELECT 005 UNION SELECT 006 UNION SELECT 007 UNION SELECT 008 UNION SELECT 009 UNION
 SELECT 010 UNION SELECT 011 UNION SELECT 012 UNION SELECT 013 UNION SELECT 014 UNION SELECT 015 UNION SELECT 016 UNION SELECT 017 UNION SELECT 018 UNION SELECT 019 UNION
 SELECT 020 UNION SELECT 021 UNION SELECT 022 UNION SELECT 023 UNION SELECT 024 UNION SELECT 025 UNION SELECT 026 UNION SELECT 027 UNION SELECT 028 UNION SELECT 029 UNION
 SELECT 030 UNION SELECT 031 UNION SELECT 032 UNION SELECT 033 UNION SELECT 034 UNION SELECT 035 UNION SELECT 036 UNION SELECT 037 UNION SELECT 038 UNION SELECT 039 UNION
 SELECT 040 UNION SELECT 041 UNION SELECT 042 UNION SELECT 043 UNION SELECT 044 UNION SELECT 045 UNION SELECT 046 UNION SELECT 047 UNION SELECT 048 UNION SELECT 049 UNION
 SELECT 050 UNION SELECT 051 UNION SELECT 052 UNION SELECT 053 UNION SELECT 054 UNION SELECT 'X' UNION SELECT 056 UNION SELECT 057 UNION SELECT 058 UNION SELECT 059 UNION
 SELECT 060 UNION SELECT 061 UNION SELECT 062 UNION SELECT 063 UNION SELECT 064 UNION SELECT 065 UNION SELECT 066 UNION SELECT 067 UNION SELECT 068 UNION SELECT 069 UNION
 SELECT 070 UNION SELECT 071 UNION SELECT 072 UNION SELECT 073 UNION SELECT 074 UNION SELECT 075 UNION SELECT 076 UNION SELECT 077 UNION SELECT 078 UNION SELECT 079 UNION
 SELECT 080 UNION SELECT 081 UNION SELECT 082 UNION SELECT 083 UNION SELECT 084 UNION SELECT 085 UNION SELECT 086 UNION SELECT 087 UNION SELECT 088 UNION SELECT 089 UNION
 SELECT 090 UNION SELECT 091 UNION SELECT 092 UNION SELECT 093 UNION SELECT 094 UNION SELECT 095 UNION SELECT 096 UNION SELECT 097 UNION SELECT 098 UNION SELECT 099 UNION
 SELECT 100 UNION SELECT 101 UNION SELECT 102 UNION SELECT 103 UNION SELECT 104 UNION SELECT 105 UNION SELECT 106 UNION SELECT 107 UNION SELECT 108 UNION SELECT 109 UNION
 SELECT 110 UNION SELECT 111 UNION SELECT 112 UNION SELECT 113 UNION SELECT 114 UNION SELECT 115 UNION SELECT 116 UNION SELECT 117 UNION SELECT 118 UNION SELECT 119 UNION
 SELECT 999 ORDER BY 1 DESC LIMIT 1
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list