- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit2f69645
committed
Fix broken list-munging in ecpg's remove_variables().
The loops over cursor argument variables neglected to ever advance"prevvar". The code would accidentally do the right thing anywaywhen removing the first or second list entry, but if it had toremove the third or later entry then it would also remove allentries between there and the first entry. AFAICS this wouldonly matter for cursors that reference out-of-scope variables,which is a weird Informix compatibility hack; between that andthe lack of impact for short lists, it's not so surprising thatnobody has complained. Nonetheless it's a pretty obvious bug.It would have been more obvious if these loops used a more standardcoding style for chasing the linked lists --- this business with the"prev" pointer sometimes pointing at the current list entry isconfusing and overcomplicated. So rather than just add a minimalband-aid, I chose to rewrite the loops in the same style we useelsewhere, where the "prev" pointer is NULL until we are dealing witha non-first entry and we save the "next" pointer at the top of theloop. (Two of the four loops touched here are not actually buggy,but it seems better to make them all look alike.)Coverity discovered this problem, but not until2b41de4 added codeto free no-longer-needed arguments structs. With that, the incorrectlink updates are possibly touching freed memory, and it complainedabout that. Nonetheless the list corruption hazard is ancient, soback-patch to all supported branches.1 parente032e4c commit2f69645
1 file changed
+29
-33
lines changedLines changed: 29 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
264 | 264 |
| |
265 | 265 |
| |
266 | 266 |
| |
267 |
| - | |
| 267 | + | |
| 268 | + | |
268 | 269 |
| |
269 |
| - | |
| 270 | + | |
270 | 271 |
| |
| 272 | + | |
271 | 273 |
| |
272 | 274 |
| |
273 | 275 |
| |
274 |
| - | |
275 |
| - | |
| 276 | + | |
| 277 | + | |
276 | 278 |
| |
277 |
| - | |
| 279 | + | |
278 | 280 |
| |
279 | 281 |
| |
280 | 282 |
| |
| |||
286 | 288 |
| |
287 | 289 |
| |
288 | 290 |
| |
289 |
| - | |
290 |
| - | |
291 |
| - | |
292 |
| - | |
293 | 291 |
| |
294 | 292 |
| |
295 |
| - | |
296 | 293 |
| |
297 |
| - | |
298 |
| - | |
299 | 294 |
| |
300 | 295 |
| |
301 | 296 |
| |
302 | 297 |
| |
303 | 298 |
| |
304 | 299 |
| |
305 | 300 |
| |
306 |
| - | |
| 301 | + | |
| 302 | + | |
307 | 303 |
| |
308 |
| - | |
| 304 | + | |
309 | 305 |
| |
| 306 | + | |
310 | 307 |
| |
311 | 308 |
| |
312 |
| - | |
| 309 | + | |
313 | 310 |
| |
314 | 311 |
| |
315 | 312 |
| |
| |||
318 | 315 |
| |
319 | 316 |
| |
320 | 317 |
| |
321 |
| - | |
| 318 | + | |
| 319 | + | |
322 | 320 |
| |
323 | 321 |
| |
324 | 322 |
| |
325 | 323 |
| |
326 | 324 |
| |
327 |
| - | |
328 |
| - | |
| 325 | + | |
| 326 | + | |
329 | 327 |
| |
330 |
| - | |
| 328 | + | |
331 | 329 |
| |
332 | 330 |
| |
| 331 | + | |
| 332 | + | |
333 | 333 |
| |
334 |
| - | |
| 334 | + | |
| 335 | + | |
335 | 336 |
| |
336 | 337 |
| |
337 | 338 |
| |
338 | 339 |
| |
339 | 340 |
| |
340 |
| - | |
341 |
| - | |
| 341 | + | |
| 342 | + | |
342 | 343 |
| |
343 |
| - | |
| 344 | + | |
344 | 345 |
| |
345 | 346 |
| |
| 347 | + | |
| 348 | + | |
346 | 349 |
| |
347 | 350 |
| |
348 | 351 |
| |
349 | 352 |
| |
350 |
| - | |
351 |
| - | |
| 353 | + | |
| 354 | + | |
352 | 355 |
| |
353 |
| - | |
| 356 | + | |
354 | 357 |
| |
355 | 358 |
| |
356 | 359 |
| |
357 | 360 |
| |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
362 | 361 |
| |
363 | 362 |
| |
364 |
| - | |
365 | 363 |
| |
366 |
| - | |
367 |
| - | |
368 | 364 |
| |
369 | 365 |
| |
370 | 366 |
| |
|
0 commit comments
Comments
(0)